aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Haw to separate a frame  to diferent  fraims Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Haw to separate a frame  to diferent  fraims" Watch "Haw to separate a frame  to diferent  fraims" New topic
Author

Haw to separate a frame to diferent fraims

Michail Petrov
Ranch Hand

Joined: Sep 04, 2008
Posts: 32
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

Joined: Oct 13, 2005
Posts: 39828
    
  28
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

Joined: Jun 13, 2009
Posts: 2215
    
    7
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

Joined: May 13, 2009
Posts: 679
The following article complements the Java Tutorial quite nicely.

http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html
Michail Petrov
Ranch Hand

Joined: Sep 04, 2008
Posts: 32
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

Joined: Jul 26, 2007
Posts: 10523
    
    9

Use JSplitPanel#setDividerLocation to half the width of your frame.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Michail Petrov
Ranch Hand

Joined: Sep 04, 2008
Posts: 32
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




Quickpost this image to Myspace, Digg, Facebook, and others!" border="0" />




Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
change panel_right to a GridLayout(2,1) and get rid of the JSeparator
Michail Petrov
Ranch Hand

Joined: Sep 04, 2008
Posts: 32
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

Joined: Jun 09, 2003
Posts: 4632
> tabbedPane.setLeftComponent(tabbedPane);

something look strange?
Michail Petrov
Ranch Hand

Joined: Sep 04, 2008
Posts: 32
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

Joined: Jun 13, 2009
Posts: 2215
    
    7
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

Joined: Sep 04, 2008
Posts: 32
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

Joined: Jun 09, 2003
Posts: 4632
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

Joined: Sep 04, 2008
Posts: 32
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

Joined: Jun 09, 2003
Posts: 4632
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Haw to separate a frame to diferent fraims