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
Resizing Panels inside a Jframe ??
jay vas
Ranch Hand
Posts: 407
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Guys :
Im having trouble figuring out how to resize INTERNAL panels in a jframe.
I know that in swt, this can be done using a "sash form". But is this
possible in
Java
Swing ?
Please let me know !!!
Thanks - j
Craig Wood
Ranch Hand
Posts: 1535
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.awt.*; import javax.swing.*; import javax.swing.event.*; public class Resizing implements ChangeListener { JPanel panel; public void stateChanged(ChangeEvent e) { JSlider slider = (JSlider)e.getSource(); int value = slider.getValue(); Dimension d = new Dimension(value, value); panel.setPreferredSize(d); panel.revalidate(); } private JPanel getPanel() { panel = new JPanel(); panel.setPreferredSize(new Dimension(200,200)); panel.setBackground(Color.red); JPanel parent = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); parent.add(panel, c); return parent; } private JSlider getSlider() { JSlider slider = new JSlider(JSlider.HORIZONTAL, 50, 500, 200); slider.addChangeListener(this); return slider; } public static void main(String[] args) { Resizing test = new Resizing(); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new JScrollPane(test.getPanel())); f.getContentPane().add(test.getSlider(), "South"); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); } }
jay vas
Ranch Hand
Posts: 407
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Thanks, but Im talking more about resizeable "frames"
inside of a JFrame that the user can resize at will.
This is called a sash form in SWT, or a "Frame" in the web browser
world.
any ideas ?
If so, Im all out, so please help !
jay vas
Ranch Hand
Posts: 407
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi never mind i figured it out...JSplitPanes...
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Adding Panels in Frame or in a Panel
Looking for layout advice
To Display background image in a Jframe/JPanel
panels not displayed fullly in Jframe
Unit testing applets
More...