Advanced OOP MCS-3 OOP BSCS-3 Lecture # 6
TOPICS TO COVER GUI Components - > JframeGUI Components - > Jframe (javax.Swing.JFrame) JFrame() JFrame(String) void super() void super(String) void setLayout() void setTitle(String) String getTitle() void setSize(int, int) void setLocation(int, int) void setBounds(int, int, int, int)
GUI Components - > JFrame add(component) void setJMenuBar(JMenuBar) void setDefaultCloseOperation(int) int getDefaultCloseOperation() DO_NOTHING_ON_CLOSE HIDE_ON_CLOSE //Default for JDialog and JFrame DISPOSE_ON_CLOSE default for JInternalFrame This removes the window from the screen and frees up any resources used by it. EXIT_ON_CLOSE (defined in the JFrame class) //Exit the application, using System.exit(0) TOPICS TO COVER
GUI Components - > Jframe -> JLabel (javax.Swing.Jlabel) JLabel(Icon) JLabel(Icon, int) int specifies horizontal alignment of label’s contents LEFT, CENTER, RIGHT, LEADING, TRAILING. JLabel(String) JLabel(String, Icon, int) JLabel(String, int) JLabel() void setText(String) String getText() void setIcon(Icon) Icon getIcon() setToolTipText(String) TOPICS TO COVER
GUI Components - > Jframe -> JLabel GUI Components - > Jframe -> JLabel void setVisible(boolean) void setVerticalTextPosition(int) int getVerticalTextPosition() void setHorizontalTextPosition(int) int getHorizontalTextPosition() Horizontal position constants LEFT CENTER RIGHT Vertical position constants TOP CENTER BOTTOM TOPICS TO COVER
GUI Components - > ImageIcon (javax.Swing.ImageIcon) ImageIcon(String)//file name GUI Components - > Jframe ->JTextField (javax.Swing.JTextField) JTextField() JTextField(String) JTextField(String, int) JTextField(int) //int is width in columns. String contains field's initial text. void setText(String) String getText() TOPICS TO COVER
GUI Components - > JFrame ->JTextField (javax.Swing.JTextField) void setEditable(boolean) boolean isEditable() void setColumns(int) int getColumns() void setHorizontalAlignment(int) int getHorizontalAlignment() void setVisible(boolean) void setFont(Font) void setForeGround(Color) TOPICS TO COVER
GUI Components - > Jframe ->JTextArea Javax.Swing.JTextArea JTextArea() JTextArea(int, int)//rows and columns JTextArea(String) JTextArea(String, int, int) void append(String) int getColumns() int getRows() int insert(String, int)//position void replaceRange(String, int, int)//starting and ending index void setColumns(int) voidsetFont(Font) voidsetLineWrap(boolean) voidsetRows(int)//number of rows TOPICS TO COVER
GOOD LUCK ! ☻...