in android-npw/src/com/android/tools/idea/npw/assetstudio/ui/ConfigureAdaptiveIconPanel.java [1474:1742]
private void addForegroundLayerTab(JBTabbedPane jBTabbedPane1, AndroidFacet androidFacet) {
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(1, 1, JBUI.emptyInsets(), -1, -1));
jBTabbedPane1.addTab("Foreground Layer", panel2);
myForegroundScrollPane = new JBScrollPane();
myForegroundScrollPane.setHorizontalScrollBarPolicy(31);
panel2.add(myForegroundScrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
null, null, null, 0, false));
myForegroundAllOptionsPanel = new JPanel();
myForegroundAllOptionsPanel.setLayout(new GridLayoutManager(6, 2, JBUI.emptyInsets(), -1, -1));
myForegroundScrollPane.setViewportView(myForegroundAllOptionsPanel);
myForegroundLayerNamePanel = new JPanel();
myForegroundLayerNamePanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundLayerNamePanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundLayerNamePanel.setVisible(true);
myForegroundAllOptionsPanel.add(myForegroundLayerNamePanel,
new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, true));
myForegroundLayerNameLabel = new JBLabel();
myForegroundLayerNameLabel.setText("Layer name:");
myForegroundLayerNamePanel.add(myForegroundLayerNameLabel,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED,
new Dimension(70, -1), null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(1, 1, JBUI.emptyInsets(), -1, -1));
myForegroundLayerNamePanel.add(panel3, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
null, null, null, 0, false));
myForegroundLayerNameTextField = new JTextField();
myForegroundLayerNameTextField.setText("(name)");
myForegroundLayerNameTextField.setToolTipText("The filename which will be used for these icons.");
panel3.add(myForegroundLayerNameTextField,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
mySourceAssetTitleSeparator = new TitledSeparator();
mySourceAssetTitleSeparator.setText("Source Asset");
myForegroundAllOptionsPanel.add(mySourceAssetTitleSeparator,
new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myForegroundAssetTypePanel = new JPanel();
myForegroundAssetTypePanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundAllOptionsPanel.add(myForegroundAssetTypePanel,
new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, true));
myForegroundAssetTypeLabel = new JLabel();
myForegroundAssetTypeLabel.setText("Asset type:");
myForegroundAssetTypePanel.add(myForegroundAssetTypeLabel,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED,
new Dimension(70, -1), null, null, 1, false));
myForegroundAssetRadioButtonsPanel = new JPanel();
myForegroundAssetRadioButtonsPanel.setLayout(new GridLayoutManager(1, 3, JBUI.emptyInsets(), -1, -1));
myForegroundAssetTypePanel.add(myForegroundAssetRadioButtonsPanel,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myForegroundClipartRadioButton = new JRadioButton();
myForegroundClipartRadioButton.setText("Clip art");
myForegroundClipartRadioButton.setToolTipText("Select from a list of clipart choices to generate Android icons for your app.");
myForegroundAssetRadioButtonsPanel.add(myForegroundClipartRadioButton,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
null, null, 0, false));
myForegroundTextRadioButton = new JRadioButton();
myForegroundTextRadioButton.setText("Text");
myForegroundTextRadioButton.setToolTipText("Enter text which will be rendered into Android icons for your app.");
myForegroundAssetRadioButtonsPanel.add(myForegroundTextRadioButton,
new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
null, null, 0, false));
myForegroundImageRadioButton = new JRadioButton();
myForegroundImageRadioButton.setText("Image");
myForegroundImageRadioButton.setToolTipText(
"Select an image, e.g. PNG, SVG, PSD, or a drawable from disk to generate Android icons for your app.");
myForegroundAssetRadioButtonsPanel.add(myForegroundImageRadioButton,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
null, null, 0, false));
myForegroundAssetTypeSourcePanel = new JPanel();
myForegroundAssetTypeSourcePanel.setLayout(new GridLayoutManager(4, 2, JBUI.emptyInsets(), -1, -1));
myForegroundAllOptionsPanel.add(myForegroundAssetTypeSourcePanel,
new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, true));
myForegroundImageAssetRowPanel = new JPanel();
myForegroundImageAssetRowPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundAssetTypeSourcePanel.add(myForegroundImageAssetRowPanel,
new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, true));
myForegroundImagePathLabel = new JBLabel();
myForegroundImagePathLabel.setText("Path:");
myForegroundImageAssetRowPanel.add(myForegroundImagePathLabel,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED,
new Dimension(70, -1), null, null, 1, false));
myForegroundImageAssetBrowser = new ImageAssetBrowser();
myForegroundImageAssetRowPanel.add(myForegroundImageAssetBrowser,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myForegroundClipartAssetRowPanel = new JPanel();
myForegroundClipartAssetRowPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundAssetTypeSourcePanel.add(myForegroundClipartAssetRowPanel,
new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, true));
myForegroundClipartLabel = new JBLabel();
myForegroundClipartLabel.setText("Clip art:");
myForegroundClipartAssetRowPanel.add(myForegroundClipartLabel,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED,
new Dimension(70, -1), null, null, 1, false));
myForegroundClipartAssetButton = new ClipartIconButton(androidFacet);
myForegroundClipartAssetRowPanel.add(myForegroundClipartAssetButton,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
myForegroundTextAssetRowPanel = new JPanel();
myForegroundTextAssetRowPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundAssetTypeSourcePanel.add(myForegroundTextAssetRowPanel,
new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, true));
myForegroundTextLabel = new JBLabel();
myForegroundTextLabel.setText("Text:");
myForegroundTextAssetRowPanel.add(myForegroundTextLabel,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED,
new Dimension(70, -1), null, null, 1, false));
myForegroundTextAssetEditor = new MultiLineTextAssetEditor();
myForegroundTextAssetRowPanel.add(myForegroundTextAssetEditor,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myForegroundColorRowPanel = new JPanel();
myForegroundColorRowPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundAssetTypeSourcePanel.add(myForegroundColorRowPanel,
new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, true));
myForegroundColorLabel = new JBLabel();
myForegroundColorLabel.setText("Color:");
myForegroundColorRowPanel.add(myForegroundColorLabel,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED,
new Dimension(70, -1), null, null, 1, false));
myForegroundColorPanel = new ColorPanel();
myForegroundColorPanel.setSelectedColor(new Color(-16777216));
myForegroundColorRowPanel.add(myForegroundColorPanel,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
new Dimension(78, -1), null, null, 0, false));
myForegroundImageOptionsPanel = new JPanel();
myForegroundImageOptionsPanel.setLayout(new GridLayoutManager(3, 2, JBUI.emptyInsets(), -1, -1));
myForegroundAllOptionsPanel.add(myForegroundImageOptionsPanel,
new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null,
null, null, 0, true));
myForegroundScalingTitleSeparator = new TitledSeparator();
myForegroundScalingTitleSeparator.setText("Scaling");
myForegroundImageOptionsPanel.add(myForegroundScalingTitleSeparator,
new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myForegroundTrimPanel = new JPanel();
myForegroundTrimPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundTrimPanel.setVisible(true);
myForegroundImageOptionsPanel.add(myForegroundTrimPanel,
new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null,
null, null, 0, true));
myForegroundTrimLabel = new JBLabel();
myForegroundTrimLabel.setText("Trim:");
myForegroundTrimPanel.add(myForegroundTrimLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED,
new Dimension(70, -1), null, null, 1, false));
myForegroundTrimOptionsPanel = new JPanel();
myForegroundTrimOptionsPanel.setLayout(new GridLayoutManager(1, 3, JBUI.emptyInsets(), -1, -1));
myForegroundTrimPanel.add(myForegroundTrimOptionsPanel,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
null, 0, false));
final Spacer spacer1 = new Spacer();
myForegroundTrimOptionsPanel.add(spacer1,
new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
myForegroundTrimYesRadioButton = new JRadioButton();
myForegroundTrimYesRadioButton.setText("Yes");
myForegroundTrimYesRadioButton.setToolTipText("Remove any transparent space from around your source asset before rendering to icon.");
myForegroundTrimOptionsPanel.add(myForegroundTrimYesRadioButton,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myForegroundTrimNoRadioButton = new JRadioButton();
myForegroundTrimNoRadioButton.setSelected(true);
myForegroundTrimNoRadioButton.setText("No");
myForegroundTrimNoRadioButton.setToolTipText("Leave the original asset unmodified.");
myForegroundTrimOptionsPanel.add(myForegroundTrimNoRadioButton,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myForegroundResizePanel = new JPanel();
myForegroundResizePanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myForegroundResizePanel.setVisible(true);
myForegroundImageOptionsPanel.add(myForegroundResizePanel,
new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null,
null, null, 0, true));
myForegroundResizeLabel = new JBLabel();
myForegroundResizeLabel.setText("Resize:");
myForegroundResizePanel.add(myForegroundResizeLabel,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED,
new Dimension(70, -1), null, null, 1, false));
myForegroundResizeSliderPanel = new JPanel();
myForegroundResizeSliderPanel.setLayout(new GridLayoutManager(1, 3, JBUI.emptyInsets(), -1, -1));
myForegroundResizePanel.add(myForegroundResizeSliderPanel,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
null, 0, false));
myForegroundResizeSlider = new JSlider();
myForegroundResizeSlider.setMaximum(400);
myForegroundResizeSlider.setMinimum(0);
myForegroundResizeSlider.setMinorTickSpacing(20);
myForegroundResizeSlider.setPaintLabels(false);
myForegroundResizeSlider.setPaintTicks(true);
myForegroundResizeSlider.setSnapToTicks(false);
myForegroundResizeSlider.setToolTipText(
"Resize the original asset using the specified scaling factor (in percent). This happens after any trimming.");
myForegroundResizeSlider.setValue(100);
myForegroundResizeSlider.setValueIsAdjusting(false);
myForegroundResizeSliderPanel.add(myForegroundResizeSlider,
new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myForegroundResizeValueTextField = new JTextField();
myForegroundResizeValueTextField.setHorizontalAlignment(4);
myForegroundResizeValueTextField.setText("100");
myForegroundResizeSliderPanel.add(myForegroundResizeValueTextField,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
new Dimension(30, -1), null, 0, false));
myForegroundResizeValueLabel = new JLabel();
myForegroundResizeValueLabel.setHorizontalAlignment(4);
myForegroundResizeValueLabel.setText("%");
myForegroundResizeSliderPanel.add(myForegroundResizeValueLabel,
new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
new Dimension(-1, -1), null, 0, false));
final Spacer spacer2 = new Spacer();
myForegroundAllOptionsPanel.add(spacer2,
new GridConstraints(5, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
}