swing

Running JPanels in their own threads.

I'm having a bit of trouble with Swing components. In one JFrame, I have a GLCanvas and a JEditorPane separated by a JSplitPane. This configuration makes display response choppy in both panels. However, when I place the GLCanvas and JEditorPane each in their own JFrame, display response is great. I would assume this is because, in ...

Whats wrong with this Java code - JLabel doesn't show in JPanel (JFrames)?

The relevent parts of this code causing the problem are in between the ------------ dashes.... import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import javax.swing.JLabel; import java.awt.Color; import java.awt.GridLayout; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt...

how to create multiple frames in java swing component

hi, i am new to java swing component. please tell me how to create multiple frames. My requirement is ,base frame should contain 2 radio buttons and if i click anyone radio button it should go to other frame and it should display 4 check boxes. Please advice ...

Getting correct sizing behaviour in a custom Swing component

I'm creating a custom Swing component that inherits from JPanel. What is the right way to override/implement the various sizing methods (getPreferredSize, setPreferredSize, getMinimumSize etc.) in order to get "good behaviour", particularly with regards to: Working with different layout managers Behaving correctly when setPreferredSiz...

swing: UI for a countdown timer

I need a variable countdown timer for between 1-10 seconds, that can be stopped and restarted. What's a good set of UI elements to use for this? I need something intuitive that uses a fairly small amount of screen real estate, comparable to a normal-sized JButton. A windup kitchen egg timer would be the best physical analogy: NOTE: I ...

Why doesn't this trivial Swing-based program terminate?

Why doesn't this Swing-based program terminate when its window is closed? import javax.swing.JFrame; import javax.swing.JOptionPane; final class App extends JFrame { private App() { super("App"); setDefaultCloseOperation(EXIT_ON_CLOSE); JOptionPane.showMessageDialog(this, "App works"); pack(); } ...

swing autocomplete text field / drop down...

Hi, We need an autocomplete component for swing, the problem with the one in jdesktop/SwingX is that we have to use a combo box and after each key stroke it simply scrolls down to the nearest match but the combo still holds the 25.000 elements. It doesn't show the 4 or 5 that are the closest match together because they can be in differe...

miglayout question: column constraints

I have a miglayout for a window where one of the columns was specified as grow but I need to modify that so it basically means "grow, but limit to _ pixels". Is there a way I can do this? ...

Java - Changing JTable renderer per class

Hello, I was hoping someone could explain something to me as I found my solution, but I don't understand why it works. I wanted to set a default renderer by Class type to a whole table, not knowing at creation where objects will be in it. I had declared a JTable and set the default renderer to that of my own, for the Calendar class so...

Center cells content in GridLayout

I have a panel with GridLayout(1, 3) but i want centralize the content of cells in this layout(without addition Panels): public MainMenu() { setLayout(new GridLayout(1, 3)); setBorder(BorderFactory.createLineBorder(Color.BLUE)); setOpaque(false); ImageComponent img = new ImageComponent("resources/music...

java refreshing an array into jList

OK so I have a JList and the content is provided with an array. I know how to add elements to an array but I want to know how to refresh a JList... or is it even possible? I tried Google. :\ import java.applet.Applet; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class bs extends JApplet implements MouseList...

Java/AWT/Swing: how to distinguish the pressed enter or return key

It looks like native applications behave differently if the user presses the Return key (right to the characters) or the Enter key (number key pad) - one time a new line character is inserted, the other time the default button is activated. How I can distinguish both key presses from Java/AWT/Swing? ...

Future of GUI development in Java?

Considering that Sun/Oracle decided to not develop Swing any further after they "invented" JavaFX JavaFX doesn't really work and some consider it a failure already the not really platform-independent nature of SWT, the manual task to dispose GUI elements and the necessity to bundle platform-specific libraries is there another way ou...

How to judge a window exsits?

could return boolean? I want to new a JFrame if the JFrame not exsits,but not to new if exsits. I creat a Map to save JFrame's name. ...

Making a JLabel Fade away

Hi, I'm writing an application that do some task and inform user upon successful completion of the task. To inform user I am using a jlabel. I want this jlabel to display the message and fadeaway after a while. I am using netbeans as my IDE. Here is the architecture of my classes. Abstract, GUI code abstract class Admin extends JFram...

How to use palette window decorators in Java/Swing?

Hi, is there an open solution to use palette window decorators in Java/Swing like in the following screenshot? JNIWrapper can do this but it is neither open nor free. ...

How can i get this kind of window?

In eclipse you can detach tabs and they will displayed in a special kind of window. Win7 with aero displays it as follows [new users aren't allowed to post images] How can i produce this frame? i have tried many styles of JFrame,JWindow,JDialog, ... ...

creating java Swing - JFrame,JRadioButton,JCheckBox

Hi all, I am new to java swing .I have pasted my code below for your reference, I am trying to create 2 JRradioButtons in JFrame and if i click that JRadioButton it should display 5 JCheckboxes for each JRadioButton in the same JFrame. JRadiobutton is displaying now but if i click that JRadioButton "JCheckboxes" is not dis...

Fade/Redraw/Modify ImageIcon on click in SWING JLabel on the fly

Hi, I want a JLabel with an Icon to look "clicked", when mouse is clicked on the Label. The Label contains an ImageIcon. Instead of changing the icon to another one, I want to redraw the ImageIcon with another colorset (e.g.: setXORMode(new Color(255,0,0) ) "on the fly". Anyone has a hint how to manage that? JLabel my_label = new JLabe...

how to add jtable and Jtextpane in single frame in java??

Hi All, I want to show jtable containing my course information,it is working fine as i have showed a seperate jtable.... Now the problem is that i want to show jtable(containing my course info)on left side,along with JtextPane in a single frame on right side so that user can select item from jtable and paste it in right side(JTextPane) i...