ComboBox: fixed issues with NetBeans org.openide.awt.ColorComboBox component

This commit is contained in:
Karl Tauber
2019-11-28 10:33:26 +01:00
parent 36b3ccc34f
commit 2197808631
5 changed files with 219 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ dependencies {
implementation( "org.swinglabs.swingx:swingx-all:1.6.5-1" )
implementation( "org.swinglabs.swingx:swingx-beaninfo:1.6.5-1" )
implementation( "com.jidesoft:jide-oss:3.6.18" )
implementation( "org.netbeans.api:org-openide-awt:RELEASE112" )
}
java {

View File

@@ -0,0 +1,110 @@
/*
* Copyright 2019 FormDev Software GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formdev.flatlaf.testing.netbeans;
import java.awt.*;
import javax.swing.*;
import com.formdev.flatlaf.testing.*;
import com.formdev.flatlaf.testing.FlatTestFrame;
import net.miginfocom.swing.*;
import org.openide.awt.*;
/**
* @author Karl Tauber
*/
public class FlatNetBeansTest
extends FlatTestPanel
{
public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatNetBeansTest" );
frame.showFrame( FlatNetBeansTest::new );
} );
}
FlatNetBeansTest() {
initComponents();
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel colorComboBoxLabel = new JLabel();
ColorComboBox colorComboBox1 = new ColorComboBox();
JComboBox<String> comboBox4 = new JComboBox<>();
ColorComboBox colorComboBox2 = new ColorComboBox();
JComboBox<String> comboBox3 = new JComboBox<>();
//======== this ========
setLayout(new MigLayout(
"insets dialog,hidemode 3",
// columns
"[]" +
"[fill]" +
"[fill]",
// rows
"[]" +
"[]" +
"[]"));
//---- colorComboBoxLabel ----
colorComboBoxLabel.setText("ColorComboBox:");
add(colorComboBoxLabel, "cell 0 0");
add(colorComboBox1, "cell 1 0");
//---- comboBox4 ----
comboBox4.setModel(new DefaultComboBoxModel<>(new String[] {
"JComboBox",
"a",
"bb",
"ccc",
"dd",
"e",
"ff",
"ggg",
"hh",
"i",
"jj",
"kkk"
}));
add(comboBox4, "cell 2 0,growx");
//---- colorComboBox2 ----
colorComboBox2.setSelectedColor(new Color(176, 62, 62));
add(colorComboBox2, "cell 1 1");
//---- comboBox3 ----
comboBox3.setModel(new DefaultComboBoxModel<>(new String[] {
"JComboBox",
"a",
"bb",
"ccc",
"dd",
"e",
"ff",
"ggg",
"hh",
"i",
"jj",
"kkk"
}));
add(comboBox3, "cell 1 2,growx");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// JFormDesigner - End of variables declaration //GEN-END:variables
}

View File

@@ -0,0 +1,63 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
root: new FormRoot {
auxiliary() {
"JavaCodeGenerator.defaultVariableLocal": true
}
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[][fill][fill]"
"$rowConstraints": "[][][]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "colorComboBoxLabel"
"text": "ColorComboBox:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "org.openide.awt.ColorComboBox" ) {
name: "colorComboBox1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox4"
"model": &DefaultComboBoxModel0 new javax.swing.DefaultComboBoxModel {
selectedItem: "JComboBox"
addElement( "JComboBox" )
addElement( "a" )
addElement( "bb" )
addElement( "ccc" )
addElement( "dd" )
addElement( "e" )
addElement( "ff" )
addElement( "ggg" )
addElement( "hh" )
addElement( "i" )
addElement( "jj" )
addElement( "kkk" )
}
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0,growx"
} )
add( new FormComponent( "org.openide.awt.ColorComboBox" ) {
name: "colorComboBox2"
"selectedColor": new java.awt.Color( 176, 62, 62, 255 )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox3"
"model": #DefaultComboBoxModel0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2,growx"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 500, 500 )
} )
}
}