Wrong « GUI « Java Swing Q&A





1. Wrong location of my system.exit code    stackoverflow.com

I have an exit button on my user form and I think I have the code for it in the wrong spot because it doesn't work. I've tried moving it ...

2. swing gui output is wrong. when I run my code.    forums.netbeans.org

When I build a swing gui (with the netbeans builder) it sometimes give a wrong output. See the example of what I mean. - reloading the form don't work - the ...

3. What wrong in code!!!    coderanch.com

Angela, Like I mentioned before, Java 2 is not supported by the available web browsers(although, netscape 6 will soon). Because this java support is not built into the browser users that want to be able to view Java 2 applets inside their browser must download a Java Runtime Environment that supports Java 2. It is run as an active-x control in ...

5. what am i doing wrong    coderanch.com

hi, I'm not sure for what's that if-clause. anyway, you're adding the row inside this if-clause. more exactly you're adding: Object[] o = null; dm.addRow(o); thus you're adding the value null. setting the rows is not necessary, i never did that. I extend the DefaultTableModel. the data should be put in a Hashtable where the key indicates the cell (Point(col, row)). ...

6. what am i doing wrong urgent    coderanch.com

Hi John, Not sure why yours doesn't work. But the code below should work for you. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; class CustomDocument extends PlainDocument { private static int MAX_LENGTH = 20; private JTextField tField; CustomDocument( JTextField field ) { tField = field; } public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if( str != ...

7. What's wrong with this while loop?    coderanch.com

Hi.. I have some very straightforward code that contains a while loop, but for some reason this while loop is not being entered, although the conditions for it are true. Can anyone help? Here's the code: public void isup_decode() { boolean equal = true; int array_count = 12; int oc = 0; String message_code = octets[12]; StringBuffer buf = new StringBuffer(message_code); ...

8. Whats wrong with this?    coderanch.com

Practicing for my Certi. and threw this together.. but it wont display the picture.. any help? All the outputs work fine, except drawImage returns false. import java.util.*; import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.*; public class PictureApplet extends Applet{ Vector myPictures; File myDirectory; String[] fileNames; Image currentImage; int currImage; int numImages; Color c; int appletHeight; int appletWidth; int pictureHeight; int ...

9. What is wrong with this code?    coderanch.com

Hi Guys, I guess this one highlights the problem with extending an adapter class. Any slight miss-spelling will mean that you are NOT overriding the desired method - the method you wrote is not doing anything and all the key stuff is going into the empty methods. The "mplements" clause does not help because of the empty implementing code in the ...





10. What am I doing Wrong? Please Help    coderanch.com

11. wrong output    coderanch.com

need help in identifying the problem with my program.anytime i run and compute the values i get a wrong answer.thanks for ever listening hears. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class CombGUI extends JPanel implements ActionListener{ JTextArea output; JTextField input1,input2,input3; javax.swing.JButton bibutton; public CombGUI(){ setLayout(null); javax.swing.JLabel input1L=new javax.swing.JLabel("Number of Trials(N):"); input1L.setBounds(10,50,250,30); add(input1L); input1=new JTextField(5); input1.setBounds(150,50,50,30); add(input1); javax.swing.JLabel input2L=new javax.swing.JLabel("Number of ...

12. wrong output    coderanch.com

How did you determine that it was a PersonalInfoForm? By the title? If so, do you set a new title for ConnectionSetupScreen? By the contents? If so, do you give ConnectionSetupScreen different contents? If you just copied the code and that's it (no modifications), then of course the frames will look and behave identically.

13. whats wrong with my code ?    coderanch.com

what i want to do the button's text should change to the text written in actionperformed method ...but how to implement ? /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package guidemo1; import java.awt.event.ActionEvent; import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; /** * * @author Admin */ public class GuiDemo1 { ...

14. What am I doing wrong here?    coderanch.com

Hi, I have just started playing around with Java canvas class to draw graphics but I cant figure out why I cant't draw an image from file. I have looked on a good few sites now and they all say the same thing; I have done what they ask, it just aint working. I want to program my own clock and ...

15. Something wrong with my GUI    forums.oracle.com

StirJcheck = new Checkbox("Stir Fried Wide Rice : RM 2.00 per person",false); AbcJcheck = new Checkbox("ABC plus Mango Ice Cream with Pistachios : RM 3.00 per person",false); OysterJcheck = new Checkbox("Oysters Mombasa : Baked with Garlic Butter:RM 5.00 per person" ,false); OldJcheck= new Checkbox("Old Fashioned Banana Pudding : RM 2.50 per person",false); ThaiJcheck= new Checkbox("Thai Hot and Sour Shrimp Soup : ...

16. whats wrong with my GUI program    forums.oracle.com

Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty St ring at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:99 4) at java.lang.Double.parseDouble(Double.java:510) at Assignment1$CalculateButtonHandler.actionPerformed(Assignment1.java:87) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19 95) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav a:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel .java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242 ) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL istener.java:236) at java.awt.Component.processMouseEvent(Component.java:6041) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5806) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4413) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4243) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322 ) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2440) at java.awt.Component.dispatchEvent(Component.java:4243) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre ...