jframe

Trouble Adding Background Image to JFrame in Netbeans 7.0

元气小坏坏 提交于 2020-02-04 05:04:56
问题 This is my first question, so please bear with me. I am working on an application (which I have already fully-designed). Now I am at the coding stage and I am having trouble placing a background image on the JFrame while still allowing it to play its role as a Container so I can put buttons on it and things of that nature. I have created this JFrame class file in Netbeans 7.0 and if someone could tell me how to do this through the interface of Netbeans that would be great (if not, just the

Trouble Adding Background Image to JFrame in Netbeans 7.0

这一生的挚爱 提交于 2020-02-04 05:04:05
问题 This is my first question, so please bear with me. I am working on an application (which I have already fully-designed). Now I am at the coding stage and I am having trouble placing a background image on the JFrame while still allowing it to play its role as a Container so I can put buttons on it and things of that nature. I have created this JFrame class file in Netbeans 7.0 and if someone could tell me how to do this through the interface of Netbeans that would be great (if not, just the

How would I code when a item has been selected in a JList?

≯℡__Kan透↙ 提交于 2020-02-03 14:13:48
问题 I have a JList with 5 options in it and when one of the items becomes selected or clicked i want the text area next to it to show a paragraph of text relative to the item clicked. It should do this for each item in the list but I cant seem to find how to do it in the API How would my program know if an item in the JList was selected so I can work with the data? 回答1: Use addListSelectionListener. You can create a subclass (anonymous or not) of ListSelectionListener that does the work you want.

How would I code when a item has been selected in a JList?

为君一笑 提交于 2020-02-03 14:06:39
问题 I have a JList with 5 options in it and when one of the items becomes selected or clicked i want the text area next to it to show a paragraph of text relative to the item clicked. It should do this for each item in the list but I cant seem to find how to do it in the API How would my program know if an item in the JList was selected so I can work with the data? 回答1: Use addListSelectionListener. You can create a subclass (anonymous or not) of ListSelectionListener that does the work you want.

Build a progress bar without launching a new Thread

◇◆丶佛笑我妖孽 提交于 2020-01-30 13:11:29
问题 I need to add a progress bar in a JFrame but I want to update this bar without generating a new Thread (for example SwingWorker that update bar in background). Is there a way to update progress bar in current thread (the current thread of the main JFrame)? In details I have first class ("ChooseGUI") that extends JFrame and that calls second class. This second class ("ProgressFrame") is another extension of JFrame: when I press a button in ChooseGUI, ChooseGUI becomes not visible,

Build a progress bar without launching a new Thread

好久不见. 提交于 2020-01-30 13:11:05
问题 I need to add a progress bar in a JFrame but I want to update this bar without generating a new Thread (for example SwingWorker that update bar in background). Is there a way to update progress bar in current thread (the current thread of the main JFrame)? In details I have first class ("ChooseGUI") that extends JFrame and that calls second class. This second class ("ProgressFrame") is another extension of JFrame: when I press a button in ChooseGUI, ChooseGUI becomes not visible,

java JFrame update amends another JFrame

蓝咒 提交于 2020-01-30 11:12:09
问题 I have a screen ( JFrame ) that picks up some of its initial population from a file. However, if the file is for some reason absent or incorrectly populated then many fields are blocked as non-editable and user is forced to click a settings button, which generates another JFrame screen. If the user then updates the file correctly I want the original screen to be re-populated with the new file data, can this be done? So I have an action listener for the settings button, which calls Java class

java JFrame update amends another JFrame

坚强是说给别人听的谎言 提交于 2020-01-30 11:12:05
问题 I have a screen ( JFrame ) that picks up some of its initial population from a file. However, if the file is for some reason absent or incorrectly populated then many fields are blocked as non-editable and user is forced to click a settings button, which generates another JFrame screen. If the user then updates the file correctly I want the original screen to be re-populated with the new file data, can this be done? So I have an action listener for the settings button, which calls Java class

Program not repainting upon JFrame height maximizing

本小妞迷上赌 提交于 2020-01-29 09:44:25
问题 You can resize JFrame with mouse dragging in several ways: You can resize it's height (top/bottom edge) You can resize it's width (left/right edge) You can resize both (in corners) You can maximize it by dragging the whole window to the monitor top edge You can maximize it's height by dragging it's top/bottom edge to the top/bottom edge of the monitor My program is being repainted on every one of this actions except the number 5. Why is that? Could that be bug in my program? It doesn't seem

What causes the Jframe to flicker while resizing?

拜拜、爱过 提交于 2020-01-26 01:49:50
问题 public class AspectRatio extends JFrame implements ComponentListener{ public AspectRatio() { setSize(100, 100); setVisible(true); addComponentListener(this); } public static void main(String[] args){ new AspectRatio(); } @Override public void componentHidden(ComponentEvent e) { // TODO Auto-generated method stub } @Override public void componentMoved(ComponentEvent e) { // TODO Auto-generated method stub } @Override public void componentResized(ComponentEvent e) { int i = Math.max(getWidth(),