Skip to content

Commit

Permalink
Merge branch 'JFormDesigner:main' into classx
Browse files Browse the repository at this point in the history
  • Loading branch information
dar-dev authored Dec 10, 2024
2 parents 67d8d44 + 145631f commit 037b03c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 25 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
cache: gradle

- name: Publish snapshot to oss.sonatype.org
run: ./gradlew publish :flatlaf-theme-editor:build -PskipFonts -Dorg.gradle.internal.publish.checksums.insecure=true -Dorg.gradle.parallel=false
run: ./gradlew publish -PskipFonts -Dorg.gradle.internal.publish.checksums.insecure=true -Dorg.gradle.parallel=false
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand Down Expand Up @@ -122,24 +122,12 @@ jobs:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}

- name: Upload demo
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
forceSsl: true
localDir: "flatlaf-demo/build/libs"
remoteDir: "."
options: "--only-newer --no-recursion --verbose=1"

- name: Upload theme editor
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
forceSsl: true
localDir: "flatlaf-theme-editor/build/libs"
remoteDir: "."
options: "--only-newer --no-recursion --verbose=1"
- name: Install lftp
run: sudo apt-get -y install lftp

- name: Upload demo and theme editor
run: >
lftp -c "set ftp:ssl-force true;
open -u ${{ secrets.FTP_USERNAME }},${{ secrets.FTP_PASSWORD }} ${{ secrets.FTP_SERVER }};
mput flatlaf-demo/build/libs/flatlaf-demo-*.jar;
mput flatlaf-theme-editor/build/libs/flatlaf-theme-editor-*.jar"
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ColorUIResource;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.extras.components.*;
import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
Expand Down Expand Up @@ -144,6 +145,36 @@ private void hideArrowButton() {
}
}

private void transparentBackground() {
EventQueue.invokeLater( () -> {
boolean transparent = transparentBackgroundCheckBox.isSelected();
Color transparentColor = new Color( 0, true );
ColorUIResource restoreColor = new ColorUIResource( Color.white );

FlatTestFrame.updateComponentsRecur( this, (c, type) -> {
if( c instanceof JComboBox ) {
((JComboBox<?>)c).putClientProperty( FlatClientProperties.STYLE,
transparent ? "background: #0000; buttonBackground: #0000; buttonEditableBackground: #0000" : null );
} else if( c instanceof JSpinner ) {
((JSpinner)c).putClientProperty( FlatClientProperties.STYLE,
transparent ? "background: #0000; buttonBackground: #0000" : null );
} else if( c instanceof JComponent )
c.setBackground( transparent ? transparentColor : restoreColor );
else
return;

// if background color is transparent it is also required to make the component non-opaque
// DO NOT USE LookAndFeel.installProperty() in real-world applications
// instead use c.setOpaque( false )
if( transparent )
LookAndFeel.installProperty( (JComponent) c, "opaque", false );
} );

if( !transparent )
SwingUtilities.updateComponentTreeUI( this );
} );
}

private void roundRectChanged() {
Boolean roundRect = roundRectCheckBox.isSelected() ? true : null;

Expand Down Expand Up @@ -398,6 +429,7 @@ private void initComponents() {
magentaCyanOutlineRadioButton = new JRadioButton();
focusPaintedCheckBox = new JCheckBox();
hideArrowButtonCheckBox = new JCheckBox();
transparentBackgroundCheckBox = new JCheckBox();
JLabel scrollBarLabel = new JLabel();
JScrollBar scrollBar1 = new JScrollBar();
JScrollBar scrollBar4 = new JScrollBar();
Expand Down Expand Up @@ -1256,6 +1288,7 @@ private void initComponents() {
"[]0" +
"[]0" +
"[]0" +
"[]0" +
"[]"));

//---- buttonTypeComboBox ----
Expand Down Expand Up @@ -1309,7 +1342,7 @@ private void initComponents() {
magentaCyanOutlineRadioButton.addActionListener(e -> outlineChanged());
panel4.add(magentaCyanOutlineRadioButton);
}
panel5.add(panel4, "cell 0 2 1 3");
panel5.add(panel4, "cell 0 2 1 4");

//---- focusPaintedCheckBox ----
focusPaintedCheckBox.setText("focusPainted");
Expand All @@ -1321,6 +1354,11 @@ private void initComponents() {
hideArrowButtonCheckBox.setText("hide arrow button");
hideArrowButtonCheckBox.addActionListener(e -> hideArrowButton());
panel5.add(hideArrowButtonCheckBox, "cell 1 3");

//---- transparentBackgroundCheckBox ----
transparentBackgroundCheckBox.setText("transparent background");
transparentBackgroundCheckBox.addActionListener(e -> transparentBackground());
panel5.add(transparentBackgroundCheckBox, "cell 1 4");
}
add(panel5, "cell 5 13 2 10,grow");

Expand Down Expand Up @@ -1728,6 +1766,7 @@ private void initComponents() {
private JRadioButton magentaCyanOutlineRadioButton;
private JCheckBox focusPaintedCheckBox;
private JCheckBox hideArrowButtonCheckBox;
private JCheckBox transparentBackgroundCheckBox;
private JSlider slider1;
private JSlider slider6;
private JCheckBox sliderPaintTrackCheckBox;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ new FormModel {
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[][]"
"$rowConstraints": "[]0[]0[]0[]0[]"
"$rowConstraints": "[]0[]0[]0[]0[]0[]"
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
} ) {
name: "panel5"
Expand Down Expand Up @@ -1092,7 +1092,7 @@ new FormModel {
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "outlineChanged", false ) )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2 1 3"
"value": "cell 0 2 1 4"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "focusPaintedCheckBox"
Expand All @@ -1115,6 +1115,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "transparentBackgroundCheckBox"
"text": "transparent background"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "transparentBackground", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 13 2 10,grow"
} )
Expand Down

0 comments on commit 037b03c

Please sign in to comment.