Questions tagged [swing]
Swing is a user-interface toolkit in Java and is shipped with the standard Java SDK. It is contained within the package javax.swing.
swing
10,878
questions
551
votes
9
answers
150k
views
The Use of Multiple JFrames: Good or Bad Practice? [closed]
I'm developing an application which displays images, and plays sounds from a database. I'm trying to decide whether or not to use a separate JFrame to add images to the database from the GUI.
I'm ...
507
votes
9
answers
69k
views
Should I avoid the use of set(Preferred|Maximum|Minimum) size methods in Java Swing?
Several times I've been criticized for having suggested the use of the following methods:
setPreferredSize()
setMinimumSize()
setMaximumSize()
on Swing components. I don't see any alternatives to ...
176
votes
6
answers
65k
views
Providing white space in a Swing GUI
A GUI with no white space appears 'crowded'. How can I provide white space without resorting to explicitly setting the position or size of components?...
88
votes
5
answers
6k
views
Swing GUI listeners without AWT
I am a starting Java developer, learning just from internet tutorials. I am learning full-screen GUI applications. I was told yesterday that I shouldn't use AWT in my programs because it is outdated. ...
134
votes
2
answers
49k
views
GUI not working after rewriting to MVC
I'm practicing MVC style programming. I have a Mastermind game in a single file, working fine (maybe apart of the fact that "Check" button is invisible at start).
http://paste.pocoo.org/show/226726/
...
21
votes
3
answers
8k
views
Add a complex image in the panel, with buttons around it in one customized user interface
How can i have this image like below into the slavePanel and on top of that JPanel adjust the JButtons which looks like the image but having buttons correctly wrapped around? (Right now they are ...
69
votes
4
answers
117k
views
Loading resources like images while running project distributed as JAR archive
I am having a error for my GUI. Trying to set title bar icon then be included in a Runnable JAR.
BufferedImage image = null;
try {
image = ImageIO.read(getClass().getClassLoader().getResource("...
16
votes
4
answers
4k
views
Why is it frowned upon to use a null layout in Swing?
Recently, I started creating a program for the company I work for. Just as background info, I'm still a student and a beginner programmer, so my solution is probably not recommended and I didn't know ...
131
votes
2
answers
27k
views
How to best position Swing GUIs?
In another thread I stated that I liked to center my GUIs by doing something like this:
JFrame frame = new JFrame("Foo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane()....
26
votes
4
answers
36k
views
Java: maintaining aspect ratio of JPanel background image
I have a JPanel with a painted background image and a layout manager holding other smaller images, all of this inside a JFrame. The background image is pretty big and I want to be able to have it ...
36
votes
3
answers
24k
views
Can a progress bar be used in a class outside main?
Right now, my main just calls a gui with 10 rows. Based on how many of those rows have text, 1 of 9 classes is called (two rows must have text). The called class performs calculations that I'd like ...
65
votes
1
answer
41k
views
Swing: Obtain Image of JFrame
How do I obtain a java.awt.Image of a JFrame?
I want to obtain a screen shot of a JFrame (for later use within my application). This is presently accomplished using the robot to take a screen shot ...
43
votes
4
answers
68k
views
Creating a custom button in Java with JButton
I am trying to create a button that has a custom shape (hexagon), but otherwise acts like a normal JButton would (that is, works with an ActionListener).
I have created a class that extends ...
163
votes
4
answers
146k
views
Java Look and Feel (L&F) [closed]
I am developing a desktop application with Java Swing for my personal use.I am in need of some beautiful Look and Feel for my application. How can I do it using Java or a 3rd party API?
12
votes
3
answers
14k
views
JTable duplicate values in row
I have a JTable populated with a custom DataModel (pasted below) and when I call the populate() method, it appears to populate the table with duplicate data - each row is filled with the same value ...