Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Swing / AWT / SWT
Redirecting of one frame to another frame
Ahesanali Khanusiya
Greenhorn
Posts: 11
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
when I click any JButton than I want redirect one frame to another frame how its possible can you explain with example....
Michael Dunn
Ranch Hand
Posts: 4632
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
redirect what?
Ahesanali Khanusiya
Greenhorn
Posts: 11
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
if i click button in swing and i want go other page of swing than how its possible.....
Rob Spoor
Sheriff
Posts: 22781
131
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Use a CardLayout.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Petar Thomas
Ranch Hand
Posts: 234
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What does mean "to redirect a frame" ?
Maybe then this is "redirecting a JPanel", not "a frame"?
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Test { JFrame frame; JPanel one, two; Test(){ frame = new JFrame(); one = new JPanel(); JLabel l1 = new JLabel("one"); JButton b1 = new JButton("hop to two"); b1.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { frame.setContentPane(two); two.revalidate(); } }); one.add(l1); one.add(b1); two = new JPanel(); JLabel l2 = new JLabel("two"); JButton b2 = new JButton("hop to one"); b2.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { frame.setContentPane(one); one.revalidate(); } }); two.add(l2); two.add(b2); frame.setContentPane(one); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run(){ new Test(); } }); } }
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Two JFrames...
How to access nested frames with the frame name or id ?
How to show Modelless Frame
Frame
accessing frame contents
More...