Results 1 to 4 of 4
Thread: how to use the Component command
- 10-26-2012, 08:44 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 24
- Rep Power
- 0
how to use the Component command
i am about to start writing a gui game using java swing... i want to use the Component command, but, cannot get it to work.
here's some code:
some more code:Java Code:Component thing1 = GuiTwo.drawpanel(); System.out.println(thing1); thing1.isFocusable(); thing1.setFocusable(true); thing1.setEnabled(true); thing1.getBackground(); Rectangle sizeone = thing1.getBounds(); System.out.println(sizeone); thing1.setVisible(true); thing1.setBackground(Color.BLUE); thing1.validate(); thing1.repaint();
the code returns the value of the variable sizeone ok. but, that is all that happens. can you help me?Java Code:public class GuiTwo extends JPanel { public static Component drawpanel() { JPanel panel = new JPanel(); panel.requestFocusInWindow(); panel.getRootPane(); Color mycolor = new Color(10,10,10); panel.setBackground(mycolor); Dimension d1 = new Dimension(400, 460); panel.setSize(d1); panel.setLocation(20, 520); panel.setPreferredSize(d1); panel.validate(); panel.setLayout(null); panel.setVisible(true); panel.setFocusable(true); panel.validate(); panel.repaint(); panel.revalidate(); return panel;
thanks!
- 10-26-2012, 09:09 PM #2
Re: how to use the Component command
Java doesn't have commands, so it's not clear what your question is.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-26-2012, 10:48 PM #3
Member
- Join Date
- Mar 2012
- Posts
- 24
- Rep Power
- 0
Re: how to use the Component command
ok, i am trying to get the *funcionality* of Component to work... i guess i need a few pointers.
thx
- 10-27-2012, 04:59 AM #4
Re: how to use the Component command
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Calling methods of a component from a different component
By Mate de Vita in forum AWT / SwingReplies: 0Last Post: 10-26-2012, 08:15 PM -
What's the name of the component that...?
By balla in forum AWT / SwingReplies: 1Last Post: 07-06-2011, 03:03 AM -
Letting my program command the command prompt
By Smokey. in forum Threads and SynchronizationReplies: 4Last Post: 03-29-2011, 11:34 PM -
Component to use ?
By pbaudru in forum AWT / SwingReplies: 2Last Post: 02-17-2010, 09:55 AM -
Unable to execute command line command in java
By LordSM in forum New To JavaReplies: 1Last Post: 08-08-2007, 12:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks