Advanced GUI Programming Austin Fahsl Austin May Shane

  • Slides: 11
Download presentation
Advanced GUI Programming Austin Fahsl, Austin May, Shane Bruggeman

Advanced GUI Programming Austin Fahsl, Austin May, Shane Bruggeman

A Quick Review • Purpose: • Guide the user • Implementation: • Swing &

A Quick Review • Purpose: • Guide the user • Implementation: • Swing & AWT • Result: • Modular coding • Ease of access

AWT vs Swing AWT Swing • Abstract Windows Toolkit • All the features of

AWT vs Swing AWT Swing • Abstract Windows Toolkit • All the features of AWT • Heavyweight • Lightweight • Native code counterparts handle functionality • Handles its own functionality

Flow Layout Box Layout Border Layout Grid Layout Managers Flow. Layout, Border. Layout, Grid.

Flow Layout Box Layout Border Layout Grid Layout Managers Flow. Layout, Border. Layout, Grid. Layout, Group. Layout

Layout Managers Flow Layout Border • new Flow. Layout(); • new Border. Layout(); •

Layout Managers Flow Layout Border • new Flow. Layout(); • new Border. Layout(); • Places elements (in the order added) to the screen. • Places elements into tpredetermined spaces on the tcomponent • Starts a new line if the elements do not fit the current one • NORTH, SOUTH, EAST, WEST, CENTER

Layout Managers Grid Layout Box Layout • new Grid. Layout(int rows, int columns, panel)

Layout Managers Grid Layout Box Layout • new Grid. Layout(int rows, int columns, panel) • new Box. Layout(panel, axis); • Components take up all the space on the holder • Axis can be horizontal or vertical Box. Layout. LINE_AXIS Box. Layout. PAGE_AXIS Box. Layout. X_AXIS Box. Layout. Y_AXIS

JSlider JScroll. Pane & JMenu JTable JRadio. Button JToolbar Exploring New JComponents JTable, JRadio.

JSlider JScroll. Pane & JMenu JTable JRadio. Button JToolbar Exploring New JComponents JTable, JRadio. Button, JSlider, Jmenu, JScroll. Pane

New JComponents JTable JSlider JScroll. Pane JTable Make changes by “sliding” the bar Allows

New JComponents JTable JSlider JScroll. Pane JTable Make changes by “sliding” the bar Allows for windows larger than screen Easy data organization Use Change. Listener to detect sliding Extends Panel and adds a scroll option Should be added to a JScroll. Pane Jslider = new JSlider(); JScroll. Pane pane = new JScroll. Pane(); JTable table = new JTable(); and scrollpane. get. Viewport(). add(table);

New JComponents JMenu JRadio. Button JTool. Bar Jmenu JMenu. Bar Jmenu JMenu. Item Button.

New JComponents JMenu JRadio. Button JTool. Bar Jmenu JMenu. Bar Jmenu JMenu. Item Button. Group JRadio. Button JTool. Bar Jcomponents. . Useful for holding many options in categories Useful for chosing “one” option Provides easy access to menu options

Images & Adding Images To JButtons Buffered. Image & Image Classes • Image image

Images & Adding Images To JButtons Buffered. Image & Image Classes • Image image = Image. IO. read(new File(file)) • Buffered. Image image = Image. IO. read(new File(file)) • button. set. Icon(new Image. Icon(file));

http: //math. hws. edu/eck/cs 124/javanotes 6/c 13/index. html http: //docs. oracle. com/javase/7/docs/api/ http: //docs.

http: //math. hws. edu/eck/cs 124/javanotes 6/c 13/index. html http: //docs. oracle. com/javase/7/docs/api/ http: //docs. oracle. com/javase/tutorial/uiswing/compo nents/toolbar. html http: //www. stackoverflow. com Sources