• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanels to a JFrame Extends

 
david foley
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I just made a quick program called Test, What i would like in the End is take this Example Program and work it with my Main Project..

What i like to get done is just have my Main View GUI Class with nothing but two split panels inside it,

I then like to be able to add my 4 Panels which would have my JTextArea, JButtons and JTextFields inside those Panels into my GUI JFRAME.






JPANEL



 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the Swing tutorial on Layout Managers. Then you can add any number of components to the frame.
 
david foley
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:See the Swing tutorial on Layout Managers. Then you can add any number of components to the frame.


I have Seen them before but They show CardLayout.

I dont want to switch between a number of Panels, I just would like to have my JFRAME showing with the Panels visible Right from the Start

 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nobody said you had to use a CardLayout. That is only one of many layout managers discussed.

I just would like to have my JFRAME showing with the Panels visible Right from the Start


So create the panel and add the panel to the frame.

You don't have any problem creating the splitpane and adding it to the frame. The code for your panels would be the same. (ie, create the panel, add it to the frame).

The key is to use the layout managers properly. So download the tutorial examples and play with them if you don't understand what is going on.
 
david foley
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:Nobody said you had to use a CardLayout. That is only one of many layout managers discussed.

I just would like to have my JFRAME showing with the Panels visible Right from the Start


So create the panel and add the panel to the frame.

You don't have any problem creating the splitpane and adding it to the frame. The code for your panels would be the same. (ie, create the panel, add it to the frame).

The key is to use the layout managers properly. So download the tutorial examples and play with them if you don't understand what is going on.



how do i add a Panel from a Different Java Class to another Java Class ?
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand the question. How do you add the JSplitPane to the frame? The splitpane is defined in another class.
 
david foley
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it Working

TextArea ta = new TextArea()
splitPane.setLeftComponent(ta);

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!