• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JPanels to a JFrame Extends

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it Working

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

 
What a show! What atmosphere! What fun! What a tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic