swing

If Swing has more features to design a form. Then what is the use of AWT in java?

In java, Swing has more features than the AWT components. For example, In AWT, TextArea ta; Button btn; But its same in Swing as, JTextArea ta; JButton btn; But swing component has good in look. Then what's the need of AWT. Is there any useful feature? ...

save file with JFileChooser save dialog

i have written a java program that opens all kind of files with a jfileChooser then i want to save it in another directory with JFileChooser save dialog, but it only saves a empty file. what can i do for saving part? thanks ...

Set JComboBox Items not Selectable

How can I make some of my JComboBox Items not Selectable? I tried this: @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (not...

Additional information added to JMenuItem

Hello, I'm developing a java application and I create a dynamic JMenu by hand (depending on the input data). I add the same action for each menu item of the menu. The problem is that depending on the menu item called I would like to take a different action each time. Is there a simple way of doing this (Something like setData(Object dat...

How do I set a JLabel's background color?

In my JPanel, I set the background of a JLabel to a different color. I can see the word "Test" and it's blue, but the background doesn't change at all. How can I get it to show? this.setBackground(Color.white); JLabel label = new JLabel("Test"); label.setForeground(Color.blue); label.setBackground(Color.lightGray); this.add(label); ...

Saving files with JFileChooser save dialog

I have a class that opens the files with this part: JFileChooser chooser=new JFileChooser(); chooser.setCurrentDirectory(new File(".")); int r = chooser.showOpenDialog(ChatFrame.this); if (r != JFileChooser.APPROVE_OPTION) return; try { Login.is.sendFile(chooser.getSelectedFile(), Login.username,label_1.getText()); } catch (RemoteEx...

Is there a proved performance and memory usage benchmark on the SWT & Swing ?

Hi I want to know about SWT & Swing , memory usage and performance. which one has better performance and which one consumes less memory. Is there a proved benchmark on these measures or everybody with good experience in these fields. thanks ...

What look and feel component do I set to change the text color of a TitledBorder?

I have a group of radio buttons in my Swing application that have a border built around them as follows: radioButtonPanel.setBorder( new CompoundBorder ( BorderFactory.createTitledBorder( " Input Data " ), padBorder ) ); Our application supports two look and feels, a light and a dark one. When switching between the two, the borde...

how to show error in result in red color in java

I want to show error(text) in result in red color after compiling exec file and display it in textarea of gui using swing in java. ...

Are there any polished, commercial, Swing desktop apps?

We know that nice looking desktop applications can be produced with SWT; there are Eclipse and Vuze as example. But are there any comparable examples of commercial desktop apps written in Swing? thanks, Joe ...

Generating a SWING/Gui from Hibernate

Hi All, is there any tool that would read a something like a hibernate mapping file and would then create some stubs of java code for a java Swing client ? Thanks, ...

Proper model-view-controller design

I have a Java project that I'm trying to implement with a model-view-controller design. I have the backbone of all of the components established. I'm having some trouble deciding on how to connect it all together, particularly the view and the controller. I have a class called MainView that extends JFrame. I have various other classe...

Resizing a GLJPanel with JOGL causes my model to disappear.

I switched over to using a GLJPanel from a GLCanvas to avoid certain flickering issues, however this has created several unintended consequences of it's own. From what I've gleaned so far, GLJPanel calls GLEventListener.init() every time it's resized which either resets various openGL functions i've enabled in init() (depth test, lighti...

Java Swing and Windows XP touch events

I'm trying to find a concrete yes for some assumptions I have about developing a Java Swing app to be run on a Windows tablet device (I believe it'll be running Windows XP). We have a demo we are writing and we're leveraging previous experience with Java Swing to write the UI and I just want to make sure that touch events in Windows are...

Swing / Java2D statistics and visualisation libraries

Hi everyone, I'm looking for a multifaceted Java2D / Swing visualisation library with which I can render different statistics. Specifically, I'm looking for timeline plotting (with a configurable scrolling and compressing timeline and the ability to chart events at certain points along the timeline), line charts, pie charts, and so on, b...

why setPrefferedSize() method not working for JPanel?

i have created n JPanels and in each JPanel i have added 3 components.i add these JPanels to a new JPanel as rows. layout for n JPanels is FlowLayout and for the main panel is BorderLayout. The setPrefferedSize() method is working fine for the components which i have added in n JPanels but it is not working for n JPanels. i am trying npa...

Drop Down menu in java?

I created drop down list using java. But i am not aware of creating drop down menu like as Sliding menu. Is it possible create the drop down menu using java? ...

Recursion causes exit to exit all JFrames (terminates app)

I have made an application that gives the user the option to open up a new spawn of the application entirely. When the user does so and closes the application the entire application terminates; not just the window. How should I go about recursively spawning an application and then when the user exits the JFrame spawn; killing just that ...

Multiple Images with JScrollPane in JPanel

Ok, I am trying to add one row of multiple images to a JPanel, it can range from 15 - 30 images so I need to have a horizontal Scroll Pane in the JPanel. Now comes the hard part, how can I make it so the images can be removed then a new amount of images can be in its place? ...

Swing code in sockets

I am learning swings for making GUI. I was thinking which is the best possible way in case of socket with swings. 1. The whole swing code goes in the server file. All the handlers and logic in on server side. Client only create socket. 2. The server have logic part. The code for the swing to display interface goes on client side. Client ...