


















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The key points are:Layout, Managers, Reminder, Creation, Flow Layout, Grid Layout, Border Layout, Box Layout, Combining Layouts, Improving the Appearance
Typology: Slides
1 / 58
This page cannot be seen from the preview
Don't miss anything!



















































import java.awt.; import java.awt.event.; import javax.swing.*; public class FlowDemo extends JFrame { public FlowDemo() { super("E-Commerce Application"); Container c = getContentPane(); c.setLayout( new FlowLayout() ); :
JCheckBox jck1 = new JCheckBox("Downgrade dog to cat"); JCheckBox jck2 = new JCheckBox("Upgrade bike to car"); JCheckBox jck3 = new JCheckBox("Add speed package"); c.add( jck1 ); c.add( jck2 ); c.add( jck3 ); JButton jb1 = new JButton("place order"); c.add( jb1 ); JButton jb2 = new JButton("cancel"); c.add( jb2 ); JLabel jl = new JLabel(new ImageIcon("bmw.jpg")); c.add(jl); :
JCheckBox jck1 = new JCheckBox("Downgrade dog to cat"); JCheckBox jck2 = new JCheckBox("Upgrade bike to car"); JCheckBox jck3 = new JCheckBox("Add speed package"); c.add( jck1 ); c.add( jck2 ); c.add( jck3 ); JButton jb1 = new JButton("place order"); c.add( jb1 ); JButton jb2 = new JButton("cancel"); c.add( jb2 ); JLabel jl = new JLabel(new ImageIcon( bmw.jpg")); c.add(jl); :
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400,400); setLocationRelativeTo(null); // center the window setVisible(true); } // end of GridDemo() public static void main(String[] args) { new GridDemo(); } } // end of GridDemo class
// use a panel to stop the cancel button growing JPanel p = new JPanel(); JButton jb2 = new JButton("cancel"); p.add(jb2); c.add( p ); :