Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
In this chapter, the following content will be discussed: Problem: positioning, resizing; containers with layout; preferred size of components; other layouts; problem with layout managers; solution: composite layout; event-driven programming; java event hierarchy; listening for events. | Software Constructions LAB 09 Java Programming with SWING GUI Builder-Part III ButtonGroup A logical group of radio buttons that ensures that only one is selected at a time public ButtonGroup() public void add(JRadioButton button) The ButtonGroup is not a graphical component, just a logical group; the RadioButtons themselves are added to the container, not the ButtonGroup JTabbedPane A container that can hold many "tab" subcontainers, each with components in it public JTabbedPane() public JTabbedPane(int tabAlignment) Constructs a new tabbed pane. Defaults to having the tabs on top; can be set to JTabbedPane.BOTTOM, LEFT, RIGHT, etc. public void addTab(String title, Component comp) public void addTab(String title, Icon icon, Component comp) public void addTab(String title, Icon icon, Component comp, String tooltip) Adds the given component as a tab in this tabbed pane. Can optionally use an icon and/or tool tip. JTabbedPane methods public void insertTab(String title, . | Software Constructions LAB 09 Java Programming with SWING GUI Builder-Part III ButtonGroup A logical group of radio buttons that ensures that only one is selected at a time public ButtonGroup() public void add(JRadioButton button) The ButtonGroup is not a graphical component, just a logical group; the RadioButtons themselves are added to the container, not the ButtonGroup JTabbedPane A container that can hold many "tab" subcontainers, each with components in it public JTabbedPane() public JTabbedPane(int tabAlignment) Constructs a new tabbed pane. Defaults to having the tabs on top; can be set to JTabbedPane.BOTTOM, LEFT, RIGHT, etc. public void addTab(String title, Component comp) public void addTab(String title, Icon icon, Component comp) public void addTab(String title, Icon icon, Component comp, String tooltip) Adds the given component as a tab in this tabbed pane. Can optionally use an icon and/or tool tip. JTabbedPane methods public void insertTab(String title, Icon icon, Component comp, String tooltip, int index) public void remove(Component comp) public void remove(int index) public void removeAll() public void setSelectedComponent(Component c) public void setSelectedIndex(int index) JToolBar A movable container to hold common buttons, commands, etc public JToolBar() public JToolBar(int orientation) public JToolBar(String title) public JToolBar(String title, int orientation) Constructs a new tool bar, optionally with a title and orientation; can be JToolBar.HORIZONTAL or VERTICAL, defaults to horizontal public void add(Component comp) Adds the given component to this tool bar's horizontal/vertical flowing layout. JToolBar: Usage construct toolbar add items (usually buttons) to toolbar add toolbar to edge of BorderLayout of content pane (usually NORTH) don't put anything in other edges (N/S/E/W)! A list of selectable pre-defined items public JList() Constructs an empty JList. public JList(ListModel model) public .