Java Swing +Things by blq20285

VIEWS: 0 PAGES: 11

									Java Swing +Things



        Project Presentation by
        Chris Backo
Closing Applications

 DISPOSE_ON_CLOSE - Dispose the window when
  closed.
 DO_NOTHING_ON_CLOSE - Do nothing when the
  window is closed.
 EXIT_ON_CLOSE - Exit the application when the
  window is closed.
 HIDE_ON_CLOSE - Hide the window when the
  window is closed.
setDefaultCloseOperation(EXIT_ON_CLOSE);
Containers and Panels

   For aligning contents and such.
   Containers hold panels.
   Subdivides the window.
Glass Panes

   Create a transition effects between screens.
   Display a progress screen within the glass pane.
   Display debug information within the glass pane.
   Example
HTML in Swing

   Good for formatting text and such.
   MUCH easier than working with things such as
    setFont() and setColor() methods in Swing.. If
    you’re familiar with HTML that is.
Starting up

   JFrame or JWindow used for GUI.
   JFrames are simpler.
    One difference is JFrames don’t put buttons on OS task
    –
    bar?
public class Calculator extends JFrame {
super("Calculator"); }
Applets vs. Applications

 Applets run on browsers.
 Applications us ‘main’ method.
Reference
Reference
Components

   Visual objects are subclasses of Component class.
   Containers are components which can store
    components. For example
Container content = getContentPane();
  content.add(new JButton("Button 1"));


code referenced from code referenced from
  http://www.tutorialized.com/tutorial/Introduction-to-
  Swing/10213
JPanels

 General purpose containers for components.
For example:
JPanel panel=new JPanel();
  panel.add(new JButton("Button 1"));
  panel.add(new JButton("Button 2"));
  panel.add(new JButton("Button 3"));
  content.add(panel);
code referenced from code referenced from
  http://www.tutorialized.com/tutorial/Introduction-to-
  Swing/10213
Native Look and Feel in Java
Thank you.

								
To top