Results 1 to 5 of 5
Thread: [SOLVED] Help with JPanel
- 05-02-2008, 11:54 AM #1
Member
- Join Date
- Mar 2008
- Posts
- 24
- Rep Power
- 0
[SOLVED] Help with JPanel
Ok, i just need some help on JPanel
At the moment i have the following code, but am not to sure if its correct or not.
The code is
How do i go about in setting it up as a controller for each of the button, and to test if the button are showing, eg open up a new window with the buttonPHP Code:import javax.swing.*; import java.awt.*; public class BufButPanel extends JPanel { private Buf buf; private JButton sButton; private JButton rButton; public BufButPanel(Buf buf) { this.buf = buf; sButton = new JButton("Save"); add(sButton); rButton = new JButton("Revert"); add(rButton); } }
Thanks
- 05-02-2008, 11:59 AM #2
You can start to read ActionListeners with more details that can be found here.
Take a look at JButton Classfreedom exists in the world of ideas
- 05-03-2008, 02:17 PM #3
Member
- Join Date
- Mar 2008
- Posts
- 24
- Rep Power
- 0
Ok, i have gone through the site and had a look, just another question
How do i put a JPanel class into a JFrame class
EG. I have JPanel class for Buttons (buttons of say, new, open, exit), and a JPanel class for TextArea(text area that can be use to type in text)
I want to call both of the JPanel class into a JFrame class (a Empty Frame with only File menu, edit menu and Help menu).
I'm having difficultie in trying to call them in
- 05-03-2008, 06:37 PM #4
Create an object from those Classes
Add that object to the JFrame
eg. add(Component c) methodfreedom exists in the world of ideas
- 05-04-2008, 11:57 AM #5
Member
- Join Date
- Mar 2008
- Posts
- 24
- Rep Power
- 0
Similar Threads
-
refresh JPanel
By olesja in forum AWT / SwingReplies: 1Last Post: 04-16-2008, 03:58 PM -
Genarate JPanel
By Bill in forum AWT / SwingReplies: 6Last Post: 03-24-2008, 07:38 PM -
Problem with JPanel
By ibanez270dx in forum New To JavaReplies: 2Last Post: 11-09-2007, 05:04 PM -
JPanel Problems
By Riftwalker in forum AWT / SwingReplies: 6Last Post: 10-15-2007, 11:16 PM -
Draw on JPanel, Help
By carl in forum Java 2DReplies: 1Last Post: 07-31-2007, 06:56 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks