Hello there. I am writing a simple application in Java that does some particle simulation on a bunch of sheep (don't ask). For this I want a window with a JPanel for graphics (which will be resizable with a simple combobox that contains some standard resolutions) and some other elements like buttons to start and pause the simulation etc....
Hello,
I'm using a borderLayout to arrange my components in a JFrame and a Box(BoxLayout.X_AXIS) to put buttons next to each other. But it creates two problems:
I want the buttons to have the same size, but it automatically resizes them to fit the text within them (especially annoying when I change the text inside a button at runtime)...
I've been looking through the Java API, but have had no luck in working this out. After you initiate a JList, is there any way to replace, or reload the 'data' string? I've also been looking to do the same thing with a JComboBox.
String[] data = {"one", "two", "three", "four"};
JList dataList = new JList(data);
...
Hi,
I'm trying to internationalise a Java applet and with that, support scripts which are written from right to left. I want to set up component orientations for all java components added to the view automatically.
My solution so far has to listen to all AWTEvent's using the windows mask:
c.getToolkit().addAWTEventListener(listener, A...
I have a JTable being constructed via Groovy's SwingBuilder. I'd like to attach a closure to the table that fires when a cell is selected, but I can't seem to find the right hook.
How do I do that?
...
There is component within the application that uses com.sun.java.swing.SwingUtilities2 Now I understand that this class shouldn't be used, but it's a component within the system that uses it.
Therefore since it's no longer available in Java 6 I get a NoClassDefFoundError. How can I get around this issue without having to upgrade the co...
Hi,
I seems to me that when i call
JTree.expandPath( path )
That by default all its parents are expanded as well.
But what i actually want to do is, set up specific invisible children to be expanded in advance. So that when a node is expanded that its complete sub-tree pops-out.
I've found that internally in JTree expandedState...
I'm creating a form with a JPanel inside it for some graphics and some buttons for controlling the thing. For some reason I have to specify the JPanel to be 10 px less wide and 30 px less high than the actual graphics I want to put inside it. What causes this problem?
This is the code:
public class Window {
public Sheepness sheepness;...
I'm working on a Java Swing application. I have a button whose action runs a query on a database and then plots the results. These commands are performed from the listener on the Run button. As I understand it, this means that the thread running at this point is from the EventQueue.
Given certain input, I need to halt processing an...
JOptionPane.showMessageDialog is supposed to be a useful utility for getting user feedback as it blocks your current thread while you wait.
I would expect therefore that it would be thread-safe and that you wouldn't need to wrap the call in an invokeLater or an invokeAndWait.
Is this the case?
...
Hi.
Is there any way I can print/show images on top of each other. The picture on top will always be positioned a little lower so that the one under will show partially. How can I decide which image is on top of what image? What layout lets me do this kind of positioning?
Is there any way that I can make a border appear on the image wh...
Possibly an odd question but how can I change how my Java Swing combo box displays its list of items? The default behavior is for the list to be displayed below the combo box. There are times, when the combo box is low on the screen, that the list is displayed above the combo box. Is there a way to force it to always display above? W...
I am developing a GUI application in C# using the design mode in VS2008. Now that I am finished with the looks of the application I am ready to add some functionality to it.
What really confuses me though, is that VS2008 designer only uses the empty constructor. When developing applications in Java I normally pass around a model and con...
Instead it just opens the new frame, and when that one closes.. it not only doesnt hide and go back to the main frame as its supposed to.. it opens a second version of the first frame...
public class FreelanceBillingUI extends javax.swing.JFrame {
public FreelanceBillingUI(){
initComponents();
}
/** This method is called from wi...
Hi,
I have the following code.
try{
Twitter twitter = new Twitter(user,password);
twitter.setStatus(txtStatus.getText());
JOptionPane.showMessageDialog(null, "Success");
txtStatus.setText("");
txtStatus.requestFocus();
}catch(Exception e){
JOptionPane.showMessageDialog(null, "Some Error.\n" +
" If you ...
There seems to be many methods in Java awt Container class that are related to validate. Apparently they don't do data validation. Is it useful for a Swing developer in any cases? Some of the methods:
validate(), invalidate(), validateTree(), isValid() etc.
...
Hi all,
Pretty sure all of these approaches will work, but I'd appreciate opinions on which is the best.
Consider for argument's sake the (unfortunate) scenario where you have UI changing code and reasonably intensive (average 500ms) logic code mixed and inseparable. all of the changing ui components are on the one panel.
01 new Threa...
I am developing a business application in .NET and Java. In .NET I have developed a web-service which uses basicHttpBinding. I am consuming this web-service in a Java client. The web-service is working fine, calling it in the Java code returns an ArrayList collection of Holding class. This class is described below:
@XmlAccessorType(XmlA...
Hi,
In the Java Swing app I made it seems to me that all the component are too tightly packed.
In QT one can specify padding and margins for the layout.
Is there something similar for swing?
Here is a screen shot of my application that I thing is too tight (is it? what do you think?.
Thanks.
...
I know how to create the basic controls in Swing, but coming to industry standard application development, I lack the skills to do them.
I am designing a small Java Swing application. Instead of creating a JFrame for each purpose, I would like to create controls, display them, hide them (whenever necessary), everything in just one windo...