Results 1 to 8 of 8
- 09-16-2009, 09:39 PM #1
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Why doesn't this create a window?
Hi! I made this peice of code, almoste straight copy of the one in my java book.
But when I run it, then it does nothing!
It doesn't print an error while running nor when compiling, and it doesn't create a window!
What is wrong?
Heres my code:
Thanks for taking time reading :)PHP Code:/** * @(#)Interface.java * * * @author * @version 1.00 2009/9/16 */ import src.myapp; import javax.swing.*; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; public class run{ public static void main(String args[]){ try{ new GameFrame(); } catch (Exception e){ e.printStackTrace(); } } } class GameFrame extends JFrame implements ActionListener { JLabel status = new JLabel(""); JTextField textField = new JTextField(30); JComboBox convertOpt = new JComboBox(); JButton go = new JButton("Start"); public GameFrame() throws IOException { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); add(status); add(textField); convertOpt.addItem("Crypt"); convertOpt.addItem("Decrypt"); add(convertOpt); add(go); go.addActionListener(this); status.setText("Status: Inactive"); pack(); setVisible(true); } public void actionPerformed(ActionEvent e){ String path = textField.getText(); Boolean crypting =false; if (convertOpt.getSelectedItem().equals("Crypt")) { crypting = true; } if (convertOpt.getSelectedItem().equals("Decrypt")){ crypting = false; } if (crypting != null){ try { status.setText(crypting ? "Crypting" : "Decrypting"); myapp.Go(path,crypting); } catch (Exception error){ error.printStackTrace(); } } else { status.setText("Choose a crypting Option!"); } } }
-
- 09-17-2009, 07:03 AM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
no, so I removed that peice of comments..
But still it doesnt do anything..
- 09-17-2009, 08:06 AM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
It creates a window for me. How did you try to run it?
- 09-17-2009, 01:54 PM #5
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Thats really weard...
Hum...
Ima see whats wrong..
- 09-17-2009, 01:57 PM #6
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
aha! Jcreator messed it up and ran other file instead of this, tho the other file was in same project space so i never noticed xD
- 09-17-2009, 01:59 PM #7
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
I'm sure Jcreator does what it's told to do.
-
Similar Threads
-
change url in parent window from child window
By rakesh_n_mehta in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 07-09-2009, 12:17 PM -
how can i move one frame window to another window
By santhosh_el in forum AWT / SwingReplies: 8Last Post: 06-10-2009, 03:36 PM -
Non Rectangular Window in SWT
By Java Tip in forum SWTReplies: 0Last Post: 07-25-2008, 02:28 PM -
refresh a different window
By marceldupont in forum AWT / SwingReplies: 3Last Post: 03-22-2008, 02:44 AM -
How to create a new pop up window from jsp without changing the URL address of parent
By nihar1213 in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 08-03-2007, 04:21 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks