Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Haw to separate a frame to diferent fraims

 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The title is not so clear the point is i wont to make a diferent fraims like cels in the main fraim

For example i will show the real program




This program have a two frame in the main frame i wont to make samting like this BUT not internal fraim

thankyou

 
Campbell Ritchie
Sheriff
Pie
Posts: 49405
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Card layout? JSplitPane? JTabbedPane? Two panels?

There are lots of possibilities, but we usually discuss such questions on the Swing forum. Moving thread.
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the secton from the Swing tutorial on Using Layout Managers. You create panels and add your components to each panel and then organize the panels based on your desired layout.
 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following article complements the Java Tutorial quite nicely.

http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html
 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
New Problem this time with the BorderLayout

I craete this code




I split the frame and int the right JPanel i create two JPanel and i use a BorderLayout to control the two JPanels but i dont no haw to make the Size
of the panels i wont the first and second to be with the same Size
I search in Sun tutorial but i find only setGap(); i dont wan this


I set a Border on First Right UP Panel to separate the two Panels


Please help me with the problem
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use JSplitPanel#setDividerLocation to half the width of your frame.
 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No no i dont hav problems with SplitPane i have a problem with BorderLayout i want to have two equals JPanels the Border represent the first JPanel
and i wont the First and the second to be equal







 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change panel_right to a GridLayout(2,1) and get rid of the JSeparator
 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why i can't set JTabbedPane in Split pane



i get this eror

can not find simbol method setLeftComponent(javax.swing.TabbedPane)
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> tabbedPane.setLeftComponent(tabbedPane);

something look strange?
 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes but why the tabs are't on the TOP the are on the LEFT haw to set them on the TOP
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michail Petrov wrote:Yes but why the tabs are't on the TOP the are on the LEFT haw to set them on the TOP


Read the API for the method to use to change the location of the tab.

Or, read the tutorial on "How to Use Split Panes". You where given the link to that tutorial so you don't always have to ask such basic questions before you read the tutorial. So do some reading first, before posting questions.
 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI i final createa Card Panel but i have a litle problem with swaping the panels

hire is the code




pleasy make the chaing i wana see where i gate rong
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have duplicate declarations for most/all of your class fields

e.g.
JPanel cardPanel; //class field
JPanel cardPanel = new JPanel(new CardLayout()); //in constructor

and it should be
JPanel cardPanel; //class field
cardPanel = new JPanel(new CardLayout()); //in constructor

fix them all and it should work OK

your logic is off a little
if(e.getSource() == buttonNext)
cl.first(cardPanel); //buttonNext should be showing cl.last
 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Problem newProblem = new Problem

This time is with the methods in diferent files





and the second contend the method CreatePanel();




but when i try to compile the cod the mashine say
CAN NOT FIND THE METHOD CreatePanel(Color.color);


I import everything why gives me the problem
everything is public

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is not a swing problem - you need to study some tutorials and grasp the basics (the very basics),
then re-read your code and the error will stand out for you.

no point in us spoon-feeding you until you understand the basics
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic