1 / 8

Advanced OOP MCS-3 OOP BSCS-3 Lecture # 9

Advanced OOP MCS-3 OOP BSCS-3 Lecture # 9. TOPICS TO COVER. Ways of Arranging Components in GUI Uses Container class setLayout () method from java.awt package Visual Programming in an IDE Provides GUI design tool. Supports drag and drop. Absolute Positioning

goldy
Télécharger la présentation

Advanced OOP MCS-3 OOP BSCS-3 Lecture # 9

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced OOP MCS-3 OOP BSCS-3Lecture # 9

  2. TOPICS TO COVER Ways of Arranging Components in GUI • Uses Container class setLayout() method from java.awt package • Visual Programming in an IDE • Provides GUI design tool. • Supports drag and drop. • Absolute Positioning • Provides greatest level of control by setting setLayoutmethod to null. But it can be tedious to set absolute positioning. • Methods like setSize, setLocation, andsetBoundsare used. • Layout Managers • FlowLayout • BorderLayout • GridLayout

  3. TOPICS TO COVER FlowLayout class (java.awt.FlowLayout) • Default for javax.swing.JPanel • Components are placed from left to right in order they are added. • Automatically places components onto next row, if row is full. • FlowLayout() • FlowLayout(int) // alignment Row positioning options • FlowLayout.LEFT • FlowLayout.RIGHT • FlowLayout.CENTER (default) • void setAlignment(int) // alignment • intgetAlignment()

  4. TOPICS TO COVER BorderLayout class (java.awt.BorderLayout) • Default for javax.swing.JFrame • Arranges components in five regions • Places upto five components in a container one in each region. • Automatically displaces previous component, if component is already occupied in the position. • BorderLayout() • BorderLayout(int, int) // horizontal gap, vertical gap Regions • BorderLayout.NORTH • BorderLayout.SOUTH • BorderLayout.EAST • BorderLayout.WEST • BorderLayout.CENTER

  5. TOPICS TO COVER GridLayout class (java.awt.GridLayout) • Divides container into a grid so that components can be placed in rows and columns. • Each component has same width and height. • GridLayout() • GridLayout(int, int) // rows, columns • GridLayout(int, int, int, int) // rows, columns, horizontal gap, vertical gap • intgetColumns() • intgetHgap() • intgetRows() • intgetVgap() • void setColumns(intcols) • void setHgap(inthgap) • void setRows(introws) • void setVgap(intvgap)

  6. Color java.awt.Color • Color.BLACK • Color.BLUE • Color.CYAN • Color.DARK_GRAY • Color.GRAY • Color.GREEN • Color.LIGHT_GRAY • Color.MAGENTA • Color.ORANGE • Color.PINK • Color.RED • Color.WHITE • Color.YELLOW

  7. Color Color • Color(int, int, int) // red, green, blue ranging from 0 to 255 • Color brighter() • Color darker() • intgetRed() • intgetGreen() • intgetBlue() JColorChooser class in javax.swing.JColorChooser • Color showDialog(Component, String, Color) //component, title of dialogbox, initial color

  8. Good Luck ! ☻. . .

More Related