javax.swing.JColorChooser#createDialog ( )源码实例Demo

下面列出了javax.swing.JColorChooser#createDialog ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: marathonv5   文件: ColorEditor.java
public ColorEditor() {
    // Set up the editor (from the table's point of view),
    // which is a button.
    // This button brings up the color chooser dialog,
    // which is the editor from the user's point of view.
    button = new JButton();
    button.setActionCommand(EDIT);
    button.addActionListener(this);
    button.setBorderPainted(false);

    // Set up the dialog that the button brings up.
    colorChooser = new JColorChooser();
    dialog = JColorChooser.createDialog(button, "Pick a Color", true, // modal
            colorChooser, this, // OK button handler
            null); // no CANCEL button handler
}
 
源代码2 项目: rapidminer-studio   文件: ColorSelectionButton.java
private Color showDialog(Component component, String title, Color initialColor) throws HeadlessException {
	final JColorChooser chooser = new JColorChooser(initialColor != null ? initialColor : Color.white);

	// configuring color chooser panel

	chooser.setPreviewPanel(new JPanel());
	if (colorChoosers != null) {
		chooser.setChooserPanels(colorChoosers);
	} else {
		chooser.removeChooserPanel(chooser.getChooserPanels()[0]);
		chooser.removeChooserPanel(chooser.getChooserPanels()[1]);
	}

	// creating dialog
	ColorTracker ok = new ColorTracker(chooser);
	JDialog dialog = JColorChooser.createDialog(component, title, true, chooser, ok, null);
	dialog.setVisible(true); // blocks until user brings dialog down...
	return ok.getColor();
}
 
源代码3 项目: dragonwell8_jdk   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码4 项目: TencentKona-8   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码5 项目: jdk8u60   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码6 项目: openjdk-jdk8u   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码7 项目: openjdk-jdk8u-backup   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码8 项目: openjdk-jdk9   文件: Test4319113.java
@Override
public void actionPerformed(ActionEvent actionEvent) {
    Object object = actionEvent.getSource();
    Component component = object instanceof Component ? (Component)object : null;
    JDialog jDialog = JColorChooser.createDialog(component, "ColorChooser", false, new JColorChooser(Color.BLUE), null, null);
    jDialog.setVisible(true);
}
 
源代码9 项目: openjdk-jdk9   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码10 项目: jdk8u-jdk   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码11 项目: hottub   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码12 项目: openjdk-8-source   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码13 项目: openjdk-8   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码14 项目: jdk8u_jdk   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码15 项目: jdal   文件: ColorTableCellEditor.java
public ColorTableCellEditor() {
    button = new JButton();
    button.setActionCommand(EDIT);
    button.addActionListener(this);
    button.setBorderPainted(false);

    //Set up the dialog that the button brings up.
    colorChooser = new JColorChooser();
    dialog = JColorChooser.createDialog(button,
                                    StaticMessageSource.getMessage("ColorChooser.chooseColor"),
                                    true,  //modal
                                    colorChooser,
                                    this,  //OK button handler
                                    null); //no CANCEL button handler
}
 
源代码16 项目: jdk8u-dev-jdk   文件: Test4177735.java
static JDialog show(JColorChooser chooser) {
    JDialog dialog = JColorChooser.createDialog(null, null, false, chooser, null, null);
    dialog.setVisible(true);
    // block till displayed
    Point point = null;
    while (point == null) {
        try {
            point = dialog.getLocationOnScreen();
        }
        catch (IllegalStateException exception) {
            pause(DELAY);
        }
    }
    return dialog;
}
 
源代码17 项目: DroidUIBuilder   文件: MakeColorsPane.java
public ColorEditor()
{
	b = new JButton("Edit");
	b.addActionListener(this);

	cc = new JColorChooser();
	dl = JColorChooser.createDialog(b, "Choose a Color", true, cc,
			this, null);
}
 
源代码18 项目: snap-desktop   文件: ColorChooserPanel.java
protected Color showMoreColorsDialog() {
    JColorChooser colorChooser = new JColorChooser(getSelectedColor());
    AbstractColorChooserPanel[] oldChooserPanels = colorChooser.getChooserPanels();
    AbstractColorChooserPanel[] newChooserPanels = new AbstractColorChooserPanel[oldChooserPanels.length + 1];
    System.arraycopy(oldChooserPanels, 0, newChooserPanels, 1, oldChooserPanels.length);
    newChooserPanels[0] = new MyAbstractColorChooserPanel();
    colorChooser.setChooserPanels(newChooserPanels);
    ColorTracker colorTracker = new ColorTracker(colorChooser);
    JDialog dialog = JColorChooser.createDialog(this, "Select Colour", true, colorChooser, colorTracker, null);
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setVisible(true);
    return colorTracker.getColor();
}
 
源代码19 项目: niftyeditor   文件: HexColorCellEditor.java
public void actionPerformed(ActionEvent e) {
    colorDialog = JColorChooser.createDialog(frame, "Choose A Color", true, colorChooser, okListener, cancelListener);
    colorDialog.setVisible(true);
}
 
源代码20 项目: jpexs-decompiler   文件: ColorEditor.java
private static Color noTransparencyColorChooser(Component component, String title, Color initialColor) throws Exception {
    final JColorChooser pane = new JColorChooser(initialColor != null
            ? initialColor : Color.white);

    AbstractColorChooserPanel[] colorPanels = pane.getChooserPanels();
    for (int i = 1; i < colorPanels.length; i++) {
        AbstractColorChooserPanel cp = colorPanels[i];

        Field f = cp.getClass().getDeclaredField("panel");
        f.setAccessible(true);

        Object colorPanel = f.get(cp);
        Field f2 = colorPanel.getClass().getDeclaredField("spinners");
        f2.setAccessible(true);
        Object spinners = f2.get(colorPanel);

        Object transpSlispinner = Array.get(spinners, 3);
        if (i == colorPanels.length - 1) {
            transpSlispinner = Array.get(spinners, 4);
        }
        Field f3 = transpSlispinner.getClass().getDeclaredField("slider");
        f3.setAccessible(true);
        JSlider slider = (JSlider) f3.get(transpSlispinner);
        slider.setEnabled(false);
        Field f4 = transpSlispinner.getClass().getDeclaredField("spinner");
        f4.setAccessible(true);
        JSpinner spinner = (JSpinner) f4.get(transpSlispinner);
        spinner.setEnabled(false);
    }
    final Color[] col = new Color[]{initialColor};

    JDialog dialog = JColorChooser.createDialog(component, title, true, pane, new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            col[0] = pane.getColor();
        }
    }, null);

    dialog.setVisible(true);
    return col[0];

}