mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 15:07:11 -06:00
@@ -7,6 +7,7 @@ package com.formdev.flatlaf.testing;
|
||||
import java.awt.*;
|
||||
import java.beans.PropertyVetoException;
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.icons.FlatFileViewFloppyDriveIcon;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
@@ -49,10 +50,25 @@ public class FlatInternalFrameTest
|
||||
maximizableCheckBox.isSelected(),
|
||||
iconifiableCheckBox.isSelected() );
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBackground( new Color( (int) (Math.random() * 0xffffff) ) );
|
||||
if( iconCheckBox.isSelected() )
|
||||
internalFrame.setFrameIcon( new FlatFileViewFloppyDriveIcon() );
|
||||
|
||||
JPanel panel = new JPanel() {
|
||||
private final Color color = new Color( (int) (Math.random() * 0xffffff) | 0x20000000, true );
|
||||
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
super.paintComponent( g );
|
||||
|
||||
g.setColor( color );
|
||||
g.fillRect( 20, 20, getWidth() - 40, getHeight() - 40 );
|
||||
}
|
||||
};
|
||||
internalFrame.setContentPane( panel );
|
||||
|
||||
if( !palette.getComponentOrientation().isLeftToRight() )
|
||||
internalFrame.setComponentOrientation( ComponentOrientation.RIGHT_TO_LEFT );
|
||||
|
||||
internalFrame.setBounds( frameX + UIScale.scale( GAP ) * (frameCount % 10),
|
||||
frameY + UIScale.scale( GAP ) * (frameCount % 10), UIScale.scale( 200 ), UIScale.scale( 200 ) );
|
||||
desktopPane.add( internalFrame, JLayeredPane.DEFAULT_LAYER );
|
||||
@@ -76,6 +92,7 @@ public class FlatInternalFrameTest
|
||||
closableCheckBox = new JCheckBox();
|
||||
iconifiableCheckBox = new JCheckBox();
|
||||
maximizableCheckBox = new JCheckBox();
|
||||
iconCheckBox = new JCheckBox();
|
||||
titleLabel = new JLabel();
|
||||
titleField = new JTextField();
|
||||
createFrameButton = new JButton();
|
||||
@@ -107,6 +124,7 @@ public class FlatInternalFrameTest
|
||||
// rows
|
||||
"[fill]0" +
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]unrel" +
|
||||
"[]unrel"));
|
||||
|
||||
@@ -130,18 +148,22 @@ public class FlatInternalFrameTest
|
||||
maximizableCheckBox.setSelected(true);
|
||||
paletteContentPane.add(maximizableCheckBox, "cell 1 1,alignx left,growx 0");
|
||||
|
||||
//---- iconCheckBox ----
|
||||
iconCheckBox.setText("Frame icon");
|
||||
paletteContentPane.add(iconCheckBox, "cell 0 2");
|
||||
|
||||
//---- titleLabel ----
|
||||
titleLabel.setText("Frame title:");
|
||||
paletteContentPane.add(titleLabel, "cell 0 2");
|
||||
paletteContentPane.add(titleField, "cell 1 2");
|
||||
paletteContentPane.add(titleLabel, "cell 0 3");
|
||||
paletteContentPane.add(titleField, "cell 1 3");
|
||||
|
||||
//---- createFrameButton ----
|
||||
createFrameButton.setText("Create Frame");
|
||||
createFrameButton.addActionListener(e -> createInternalFrame());
|
||||
paletteContentPane.add(createFrameButton, "cell 1 3,alignx right,growx 0");
|
||||
paletteContentPane.add(createFrameButton, "cell 1 4,alignx right,growx 0");
|
||||
}
|
||||
desktopPane.add(palette, JLayeredPane.PALETTE_LAYER);
|
||||
palette.setBounds(15, 25, 220, 160);
|
||||
palette.setBounds(15, 25, 220, 185);
|
||||
}
|
||||
add(desktopPane, "cell 0 0,width 600,height 600");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
@@ -157,6 +179,7 @@ public class FlatInternalFrameTest
|
||||
private JCheckBox closableCheckBox;
|
||||
private JCheckBox iconifiableCheckBox;
|
||||
private JCheckBox maximizableCheckBox;
|
||||
private JCheckBox iconCheckBox;
|
||||
private JLabel titleLabel;
|
||||
private JTextField titleField;
|
||||
private JButton createFrameButton;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -14,7 +14,7 @@ new FormModel {
|
||||
add( new FormContainer( "javax.swing.JInternalFrame", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$columnConstraints": "[fill][fill]"
|
||||
"$rowConstraints": "[fill]0[]0[]unrel[]unrel"
|
||||
"$rowConstraints": "[fill]0[]0[]0[]unrel[]unrel"
|
||||
} ) {
|
||||
name: "palette"
|
||||
"visible": true
|
||||
@@ -50,29 +50,35 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "iconCheckBox"
|
||||
"text": "Frame icon"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "titleLabel"
|
||||
"text": "Frame title:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "titleField"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "createFrameButton"
|
||||
"text": "Create Frame"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "createInternalFrame", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3,alignx right,growx 0"
|
||||
"value": "cell 1 4,alignx right,growx 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"x": 15
|
||||
"y": 25
|
||||
"width": 220
|
||||
"height": 160
|
||||
"height": 185
|
||||
"layer": 100
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
|
||||
@@ -403,8 +403,8 @@ public class FlatTestFrame
|
||||
|
||||
private void updateComponentsRecur( Container container, BiConsumer<Component, String> action ) {
|
||||
for( Component c : container.getComponents() ) {
|
||||
if( c instanceof JPanel ) {
|
||||
updateComponentsRecur( (JPanel) c, action );
|
||||
if( c instanceof JPanel || c instanceof JDesktopPane ) {
|
||||
updateComponentsRecur( (Container) c, action );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,11 +130,34 @@ Component.focusColor=#97c3f3
|
||||
#Component.arc=8
|
||||
|
||||
|
||||
#---- Desktop ----
|
||||
|
||||
Desktop.background=#afe
|
||||
|
||||
|
||||
#---- HelpButton ----
|
||||
|
||||
HelpButton.questionMarkColor=#0000ff
|
||||
|
||||
|
||||
#---- InternalFrame ----
|
||||
|
||||
InternalFrame.activeTitleBackground=#800
|
||||
InternalFrame.activeTitleForeground=#faa
|
||||
InternalFrame.inactiveTitleBackground=#080
|
||||
InternalFrame.inactiveTitleForeground=#afa
|
||||
|
||||
InternalFrame.activeBorderColor=#f00
|
||||
InternalFrame.inactiveBorderColor=#0f0
|
||||
|
||||
InternalFrame.buttonHoverBackground=#080
|
||||
InternalFrame.buttonPressedBackground=#0a0
|
||||
InternalFrame.closeHoverBackground=#008
|
||||
InternalFrame.closePressedBackground=#00f
|
||||
InternalFrame.closeHoverForeground=#fff
|
||||
InternalFrame.closePressedForeground=#fff
|
||||
|
||||
|
||||
#---- Label ----
|
||||
|
||||
Label.foreground=#008800
|
||||
|
||||
Reference in New Issue
Block a user