0% found this document useful (0 votes)
5 views13 pages

Mid Term Act1

The document provides a comprehensive overview of various Swing components and controls in Java, detailing their properties and functionalities. It covers elements such as panels, scroll panes, internal frames, and various controls like buttons, checkboxes, and text fields, along with their respective attributes. Additionally, it includes information on Swing menus, including menu bars, menu items, and popups, emphasizing their configuration options.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views13 pages

Mid Term Act1

The document provides a comprehensive overview of various Swing components and controls in Java, detailing their properties and functionalities. It covers elements such as panels, scroll panes, internal frames, and various controls like buttons, checkboxes, and text fields, along with their respective attributes. Additionally, it includes information on Swing menus, including menu bars, menu items, and popups, emphasizing their configuration options.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Remolado, Domenic, I.

BSIT 1-A (Mid-Term Act 1)


A. Swing Containers
1. Panel
Properties:
background: Sets the background color of the panel.
foreground: Sets the color of text and graphics inside the panel.
border: Defines a border around the panel.
layout: Specifies how components inside the panel are arranged (AbsoluteLayout
FlowLayout, BorderLayout, GridLayout).
opaque: If true, the panel will paint its background.
toolTipText: The text displayed when the user hovers the mouse over the component.
name: The internal identifier used to reference the panel in the code.
visible: Controls whether the panel is displayed on the screen.
enabled: Determines whether the panel and its child components can receive input.
2. Scroll Pane
Properties:
background – Sets the background color of the scroll pane.
foreground – Sets the color of text or elements inside the scroll pane.
border – Adds a border around the scroll pane.
viewportView – Defines the component displayed inside the scrollable area.
horizontalScrollBarPolicy – Controls when the horizontal scrollbar is visible (always, never,
or as needed).
verticalScrollBarPolicy – Controls when the vertical scrollbar is visible.
opaque – Determines whether the background of the scroll pane is painted.
toolTipText – Shows a hint when hovering over the scroll pane.
name – Internal code name for referencing the scroll pane.
visible – Controls the visibility of the scroll pane.
enabled – Enables or disables user interaction with the scroll pane.
3. Internal Frame
Properties:
title – The title text shown in the internal frame’s title bar.
closable – If true, the frame can be closed by the user.
iconifiable – If true, the frame can be minimized to an icon.
maximizable – If true, the frame can be maximized.
resizable – If true, allows the user to resize the frame.
frameIcon – The icon shown in the internal frame's title bar.
defaultCloseOperation – Specifies what happens when the frame is closed (hide, dispose,
etc.).
layer – Determines the depth or Z-order of the frame inside a desktop pane.
background – Sets the background color of the internal frame.
border – Draws a frame around the internal frame.
toolTipText – Text that appears when hovering over the internal frame.
name – Used to reference the internal frame in code.
visible – Sets the frame to appear or stay hidden.
enabled – If false, disables user interaction with the frame.
4. Tabbed Pane
Properties:
background – Sets the background color of the tabbed area.
foreground – Sets text or label color of the tabs.
tabPlacement – Sets where the tabs appear (Top, Bottom, Left, Right).
tabLayoutPolicy – Defines how tabs are displayed if there are too many (Wrap or Scroll).
toolTipText – Hint displayed when mouse hovers over the tabbed pane.
name – Internal code reference name.
visible – Determines if the tabbed pane is currently visible.
enabled – Enables or disables the entire tab group for user interaction
5. Tool Bar
Properties:
floatable – Allows the toolbar to be detached from its position.
orientation – Sets whether the toolbar is horizontal or vertical.
rollover – Enables visual feedback when hovering over toolbar buttons.
background – Color behind the toolbar.
foreground – Color for text/icons on the toolbar.
border – Visual border of the toolbar.
toolTipText – Help text for the toolbar.
name – Code reference name.
visible – Shows or hides the toolbar.
enabled – Enables or disables toolbar and its buttons.
6. Layered Pane
Properties:
background – Background color of the pane.
foreground – Color of child components' text or graphics.
border – A visible edge around the pane.
layer – Sets the Z-order layer for overlapping components.
layout – Controls the arrangement of components.
name – Internal reference name.
visible – Determines visibility on the UI.
enabled – Enables or disables interaction with components in the layer
7. Slip Pane
Properties:
orientation – Determines if the split is horizontal or vertical.
dividerLocation – Sets the initial position of the divider.
continuousLayout – If true, components update continuously when dragging the divider.
oneTouchExpandable – If true, shows a quick expand/collapse button.
resizeWeight – Ratio of how space is distributed when resizing.
background – Sets background color.
foreground – Sets text/icon color.
border – Adds a visual edge.
name – Used for identification in code.
visible – Shows or hides the split pane.
enabled – Enables or disables divider and child panels.
8. Desktop Pane
Properties:
background – Color behind internal frames.
foreground – Color of text/icons inside internal frames.
dragMode – Sets how internal frames are dragged (Outline or Live).
layout – Manages internal frame positioning.
name – Identifier in code.
visible – Shows or hides the desktop pane.
enabled – Enables or disables interaction with the pane or its internal frames.

B. Swing Controls
1. Label
Properties: text – The string of text displayed by the label.
icon – An image displayed alongside or instead of the text.
horizontalAlignment – Aligns the text horizontally (left, center, right).
verticalAlignment – Aligns the text vertically (top, center, bottom).
horizontalTextPosition – Positions the text horizontally relative to the icon.
verticalTextPosition – Positions the text vertically relative to the icon.
font – Sets the font style (type, size, weight) of the text.
foreground – Changes the text color.
background – Sets background color, usually only visible if opaque is true.
opaque – If check, allows the background to be painted.
toolTipText – Shows help text when mouse hovers over the label.
name – Internal identifier used in code.
visible – Controls whether the label is shown or hidden.
enabled – If check, greys out the label and disables updates.
2. Check Box
Properties:
text – Label displayed beside the checkbox.
selected – Whether it’s initially checked or not.
icon – Image used instead of the checkbox box.
font – Font of the label.
foreground – Label text color.
background – Background behind the box and label.
border – Edge around the checkbox.
toolTipText – Mouse over help text.
name – Internal identifier.
visible – Controls visibility.
enabled – Determines if the box can be checked or unchecked.
3. Combo Box
Properties:
model – The list of items in the dropdown.
selectedItem – The item that is currently selected.
editable – Allows the user to type their own value if true.
font – Font of the text and items.
foreground – Color of the selected text.
background – Background of the dropdown.
toolTipText – Hover hint.
name – Internal reference.
visible – Show or hide combo box.
enabled – Enable or disable user interaction.
4. Text Area
Properties:
text – Text shown in the area.
columns – Width in character columns.
rows – Height in number of rows.
lineWrap – Enables automatic wrapping of long lines.
wrapStyleWord – Wraps at word boundaries instead of in the middle of words.
editable – Determines if the user can type or change the text.
font – Changes the font of the text.
foreground – Text color.
background – Background color.
border – Edge appearance.
toolTipText – Hover-help text.
name – Internal name for code reference.
visible – Controls visibility.
enabled – Enables or disables input.
5. Progress Bar
Properties:
value – Current progress.
minimum – Start value.
maximum – End value.
orientation – Horizontal/vertical.
stringPainted – Displays percentage as text.
foreground – Color of progress fill.
background – Background color.
font – Font of progress text.
toolTipText – Help on hover.
name – Code name.
visible – Show/hide.
enabled – Not interactive, just display.
6.Spinner
Properties:
model – The data model (numbers, dates, or list).
value – Current value displayed.
editor – Customizes text editor.
font – Font style.
foreground – Text color.
background – Background color.
toolTipText – Description on hover.
border – Border around spinner.
name – Reference name.
visible – Visibility toggle.
enabled – Enables or disables use.
7. Editor Pane
Properties:
contentType – Sets MIME type (e.g., text/html).
text – Content inside the editor.
editable – Whether user can change text.
font – Text font.
foreground – Text color.
background – Background color.
toolTipText – Hover description.
name – Reference name.
visible – Show/hide.
enabled – Enables/disables typing.
8. Button
Properties:
text – Text displayed on the button.
icon – Image shown on the button.
pressedIcon – Image displayed when the button is clicked.
rolloverIcon – Image shown when mouse hovers over the button.
selected – Sets whether the button appears selected (true or false).
enabled – Enables or disables the button (user can't click when false).
mnemonic – Sets a keyboard shortcut key (Alt + key).
actionCommand – Command string sent with events for identification.
font – Changes the text font on the button.
foreground – Changes the text color.
background – Changes the button’s background color.
border – Adds a border around the button.
toolTipText – Hint text when hovering over the button.
name – Internal name used in code.
visible – Shows or hides the button.
opaque – Determines whether the background is painted.
9. Radio Button
Properties:
text – Label displayed beside the button.
selected – If true, the button is selected.
buttonGroup – Grouping of buttons so only one can be selected.
icon – Image displayed with the button.
font – Text style.
foreground – Text color.
background – Background color.
border – Visual edge.
toolTipText – Hover-help text.
name – Code name.
visible – Shown or hidden.
enabled – Can or cannot be selected.
10. List
Properties:
model – The items in the list.
selectedIndex – The selected item’s index.
selectionMode – Allows single or multiple selection.
visibleRowCount – Number of visible rows without scrolling.
font – Font of list items.
foreground – Text color.
background – Background color.
border – Visual edge.
toolTipText – Help shown on hover.
name – Reference ID for coding.
visible – Show/hide the list.
enabled – Can/can’t interact with the list.
11. Scroll Bar
Properties:
value: The current scroll position.
minimum: The starting position of the scroll bar.
maximum: The ending position of the scroll bar.
orientation: Whether the scroll bar is horizontal or vertical.
visibleAmount: The amount of content that is visible in the viewport.
unitIncrement: The amount of scrolling when the user clicks the arrow buttons.
blockIncrement: The amount of scrolling when the user clicks the track area.
toolTipText: Text displayed when the user hovers over the scroll bar.
12. Formatted Field
Properties:
value – The formatted value.
formatterFactory – Defines the format (e.g., date, number).
editable – Allows user input.
font – Text style.
foreground – Text color.
background – Field color.
toolTipText – Hover help.
border – Field outline.
name – Used in code.
visible – Show/hide.
enabled – Enable/disable interaction.
13. Separator
Properties:
orientation – Vertical or horizontal line.
foreground – Line color.
background – Color behind line.
toolTipText – Description when hovering.
name – Code reference.
visible – Shows or hides the line.
enabled – Non-interactive, always enabled.
14. Tree
Properties:
model – Data model for nodes.
rootVisible – Whether the root node is shown.
showsRootHandles – Show +/- handles.
editable – Allows text editing of nodes.
font – Text style.
foreground – Node label color.
background – Tree background.
toolTipText – Description text.
border – Outline border.
name – Reference ID.
visible – Show/hide.
enabled – Allows selection or not.
15. Toggle Button
Properties:
text – Label text.
selected – Shows whether the button is toggled on or off.
icon – Icon shown with button.
pressedIcon – Icon when pressed.
rolloverIcon – Icon when hovered.
font – Font style of label.
foreground – Text color.
background – Background color.
border – Frame around the button.
toolTipText – Hint on hover.
name – Internal identifier.
visible – Show or hide toggle button.
enabled – Enable or disable interaction.
16. Button Group
Properties:
Contains no properties, but it’s used to group Radio Button so that only one button in the
group can be selected at a time.
17. Text Field
Properties:
text – The text displayed in the field.
columns – Number of character columns wide the field should be.
editable – If false, text can't be changed by the user.
font – Sets font of the text.
foreground – Sets the color of the text.
background – Sets the background color.
border – Sets the visual edge around the field.
toolTipText – Shows help text on mouse hover.
name – Reference name used in code.
visible – If false, hides the field.
enabled – If false, disables typing and greys out the field.
caretPosition – Position of the text cursor.
18. Slider
Properties:
value: The current slider position.
minimum: The minimum value of the slider.
maximum: The maximum value of the slider.
orientation: Whether the slider is horizontal or vertical.
majorTickSpacing: The spacing between major ticks.
minorTickSpacing: The spacing between minor ticks.
paintTicks: Whether to paint tick marks on the slider.
paintLabels: Whether to paint labels on the slider.
toolTipText: Text displayed when the user hovers over the slider.
19. Password Field
Properties:
echoChar – Character shown instead of actual password characters.
text – Gets/sets the value entered (not usually visible).
columns – Width in character columns.
editable – Allows or prevents user input.
font – Font of the characters.
foreground – Color of password dots or characters.
background – Field background color.
border – Visual edge.
toolTipText – Hover hint.
name – Reference name in code.
visible – Determines if the field is shown.
enabled – Allows or disallows typing.
20. Text Pane
Properties:
text: The content displayed in the text pane.
contentType: The type of content, such as plain text or HTML.
editable: Whether the text can be edited.
font: The font style of the text.
foreground: The color of the text.
background: The background color of the text pane.
toolTipText: Text displayed when the user hovers over the text pane.
21. Table
Properties:
model: The data model holding the table’s rows and columns.
rowHeight: The height of the rows in the table.
gridColor: The color of the grid lines.
selectionMode: The selection mode for rows (single or multiple).
font: The font style of the table’s text.
foreground: The color of the text in the table.
background: The background color of the table.
toolTipText: Text displayed when the user hovers over the table.

C. Swing Menus
1. Menu Bar
Properties:
background - The background color of the menu bar.
foreground - The color of the text in the menu bar.
font - The font style used for the text in the menu bar.
toolTipText - Text displayed when the user hovers over the menu bar.
border - Defines the border style around the menu bar.
menus - A list of Menu objects added to the menu bar.
2. Menu Item
Properties:
text - The label or name of the menu item.
icon - An image displayed alongside the menu item text.
mnemonic - The keyboard shortcut associated with the menu item.
accelerator - The key combination used to invoke the menu itme.
enabled - Determines whether the menu item is enabled (true) or disabled (false).
selected - Indicates whether the item is selected, for toggle items.
font - The font style for the menu item text.
foreground - The color of the text in the menu item.
background - The background color of the menu item.
toolTipText - Text displayed when the user hovers over the menu item.
3. Menu Item/Radio Button
Properties:
text - The label of the radio button item.
selected - Indicates whether the radio button is selected (true) or not (false).
mnemonic - The keyboard shortcut for the radio button item.
font - The font style of the radio button's text.
foreground - The color of the radio button's text.
background - The color of the radio button's background.
group - The Button Group this radio button belongs to.
toolTipText - The text shown when the user hovers over the radio button.
4. Separator
Properties:
foreground - The color of the separator line.
background - The background color behind the separator.
orientation - Defines whether the separator is vertical or horizontal.
toolTipText - Text displayed when the user hovers over the separator.
5. Menu
Properties:
text - The label of the menu.
font - The font style of the menu’s text.
foreground - The color of the menu’s text.
background - The background color of the menu.
mnemonic - The keyboard shortcut to open the menu.
enabled - Whether the menu is enabled or disabled.
toolTipText - Text displayed when the user hovers over the menu.
items - A collection of Menu Item objects that belong to this menu.
6. Menu Item / Check Box
Properties:
text - The label of the checkbox menu item.
selected - Indicates whether the checkbox is selected (checked) or deselected (unchecked).
mnemonic - The keyboard shortcut associated with the checkbox item.
font - The font style of the checkbox menu item’s text.
foreground - The color of the text in the checkbox menu item.
background - The background color of the checkbox menu item.
toolTipText - Text displayed when the user hovers over the checkbox item.
7. Popup Menu
items - A collection of Menu Item objects that make up the popup menu.
font - The font style for the popup menu items.
foreground - The color of the text in the popup menu items.
background - The background color of the popup menu.
enabled - Whether the popup menu is enabled or disabled.
toolTipText - Text displayed when the user hovers over the popup menu.

D. Swing Windows
1. Dialog
Properties:
background - The background color of the dialog window.
foreground - The color of the text in the dialog.
font - The font style used for the text in the dialog.
toolTipText - Text displayed when the user hovers over the dialog.
modal - Defines whether the dialog blocks input to other windows (true) or not (false).
title - The title of the dialog window.
size - Defines the size of the dialog.
location - The position of the dialog on the screen.
resizable - Whether the dialog is resizable by the user (true) or not (false).
visible - Whether the dialog is visible (true) or hidden (false).
defaultCloseOperation - Defines the operation when the dialog is closed.
2. File Chooser
Properties:
background - The background color of the file chooser.
foreground - The color of the text in the file chooser.
font - The font style used for the text in the file chooser.
toolTipText - Text displayed when the user hovers over the file chooser.
currentDirectory - The current directory the file chooser starts in.
selectedFile - The file that is selected in the file chooser.
fileFilter - A filter used to display files with specific extensions.
multiSelectionEnabled - Whether multiple files can be selected (true) or not (false).
dialogTitle - The title of the file chooser dialog window.
approveButtonText - The text of the button that approves the file selection.
3. Frame
Properties:
background - The background color of the frame.
foreground - The color of the text in the frame.
font - The font style used for the text in the frame.
toolTipText - Text displayed when the user hovers over the frame.
title - The title of the frame window.
size - Defines the size of the frame.
location - The position of the frame on the screen.
resizable - Whether the frame is resizable by the user (true) or not (false).
visible - Whether the frame is visible (true) or hidden (false).
iconImage - The image icon for the frame.
4. Option Pane
Properties:
background - The background color of the option pane.
foreground - The color of the text in the option pane.
font - The font style used for the text in the option pane.
toolTipText - Text displayed when the user hovers over the option pane.
message - The message displayed in the option pane.
optionType - The type of buttons to display (YES_NO_OPTION, and
OK_CANCEL_OPTION).
messageType - The type of message (ERROR_MESSAGE, or
INFORMATION_MESSAGE).
icon - The icon associated with the message in the option pane.
initialValue - The default selected value.
selectionValues - A list of values that are options to select from.
5. Color Chooser
Properties:
background - The background color of the color chooser dialog.
foreground - The color of the text in the color chooser.
font - The font style used for the text in the color chooser.
toolTipText - Text displayed when the user hovers over the color chooser.
selectedColor - The color currently selected in the color chooser.
customColors - The set of custom colors that the user has defined.
visible - Whether the color chooser is visible (true) or hidden (false).
dialogTitle - The title of the color chooser dialog window.

E. Swing Filters
1. Glue
Properties:
size - The flexible space that adapts to the remaining space available in the container. It can
adjust itself based on the container's layout.
2. Rigid Area
Properties:
width - The fixed width of the rigid area.
height - The fixed height of the rigid area.
size - The fixed dimensions (width and height) of the rigid area.
3. Horizontal Glue
Properties:
size - The flexible horizontal space that adjusts to the remaining horizontal space in the
container.
4. Vertical Glue
Properties:
size - The flexible vertical space that adjusts to the remaining vertical space in the container.
5. Horizontal Strut
Properties:
width - The fixed width of the horizontal strut. It remains constant.
6, Vertical Strut
Properties:
height - The fixed height of the vertical strut. It remains constant.

You might also like