in android-npw/src/com/android/tools/idea/npw/assetstudio/ui/ConfigureAdaptiveIconPanel.java [1246:1472]
private void addBackgroundLayerTab(JBTabbedPane jBTabbedPane1) {
final JPanel panel4 = new JPanel();
panel4.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
jBTabbedPane1.addTab("Background Layer", panel4);
myBackgroundScrollPane = new JBScrollPane();
myBackgroundScrollPane.setHorizontalScrollBarPolicy(31);
panel4.add(myBackgroundScrollPane, 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));
myBackgroundAllOptionsPanel = new JPanel();
myBackgroundAllOptionsPanel.setLayout(new GridLayoutManager(6, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundScrollPane.setViewportView(myBackgroundAllOptionsPanel);
myBackgroundLayerNamePanel = new JPanel();
myBackgroundLayerNamePanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundLayerNamePanel.setVisible(true);
myBackgroundAllOptionsPanel.add(myBackgroundLayerNamePanel,
new GridConstraints(0, 0, 1, 2, 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, true));
myBackgroundLayerNameLabel = new JBLabel();
myBackgroundLayerNameLabel.setText("Layer name:");
myBackgroundLayerNamePanel.add(myBackgroundLayerNameLabel,
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 panel5 = new JPanel();
panel5.setLayout(new GridLayoutManager(1, 1, JBUI.emptyInsets(), -1, -1));
myBackgroundLayerNamePanel.add(panel5, 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));
myBackgroundLayerNameTextField = new JTextField();
myBackgroundLayerNameTextField.setText("(name)");
myBackgroundLayerNameTextField.setToolTipText("The filename which will be used for these icons.");
panel5.add(myBackgroundLayerNameTextField,
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));
myBackgroundSourceAssetTitleSeparator = new TitledSeparator();
myBackgroundSourceAssetTitleSeparator.setText("Source Asset");
myBackgroundAllOptionsPanel.add(myBackgroundSourceAssetTitleSeparator,
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));
myBackgroundAssetTypePanel = new JPanel();
myBackgroundAssetTypePanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundAllOptionsPanel.add(myBackgroundAssetTypePanel,
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));
myBackgroundAssetTypeLabel = new JLabel();
myBackgroundAssetTypeLabel.setText("Asset type:");
myBackgroundAssetTypePanel.add(myBackgroundAssetTypeLabel,
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));
myBackgroundAssetRadioButtonsPanel = new JPanel();
myBackgroundAssetRadioButtonsPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundAssetTypePanel.add(myBackgroundAssetRadioButtonsPanel,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null,
null, null, 0, false));
myBackgroundImageRadioButton = new JRadioButton();
myBackgroundImageRadioButton.setText("Image");
myBackgroundImageRadioButton.setToolTipText(
"Select an image, e.g. PNG, SVG, PSD, or a drawable from disk to generate Android icons for your app.");
myBackgroundAssetRadioButtonsPanel.add(myBackgroundImageRadioButton,
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));
myBackgroundColorRadioButton = new JRadioButton();
myBackgroundColorRadioButton.setText("Color");
myBackgroundColorRadioButton.setToolTipText("Select from a background color for the Android icons for your app.");
myBackgroundAssetRadioButtonsPanel.add(myBackgroundColorRadioButton,
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));
myBackgroundAssetTypeSourcePanel = new JPanel();
myBackgroundAssetTypeSourcePanel.setLayout(new GridLayoutManager(3, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundAllOptionsPanel.add(myBackgroundAssetTypeSourcePanel,
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));
myBackgroundImageAssetRowPanel = new JPanel();
myBackgroundImageAssetRowPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundAssetTypeSourcePanel.add(myBackgroundImageAssetRowPanel,
new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, new Dimension(30, 30), null, null, 0, true));
myBackgroundImagePathLabel = new JBLabel();
myBackgroundImagePathLabel.setText("Path:");
myBackgroundImageAssetRowPanel.add(myBackgroundImagePathLabel,
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));
myBackgroundImageAssetBrowser = new ImageAssetBrowser();
myBackgroundImageAssetRowPanel.add(myBackgroundImageAssetBrowser,
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));
myBackgroundColorRowPanel = new JPanel();
myBackgroundColorRowPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundAssetTypeSourcePanel.add(myBackgroundColorRowPanel,
new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, new Dimension(30, 30), null, null, 0, true));
myBackgroundColorLabel = new JBLabel();
myBackgroundColorLabel.setText("Color:");
myBackgroundColorRowPanel.add(myBackgroundColorLabel,
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));
myBackgroundColorPanel = new ColorPanel();
myBackgroundColorPanel.setSelectedColor(new Color(-16777216));
myBackgroundColorRowPanel.add(myBackgroundColorPanel,
new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, new Dimension(78, -1), null, null, 0, false));
myBackgroundScalingTitleSeparator = new TitledSeparator();
myBackgroundScalingTitleSeparator.setText("Scaling");
myBackgroundAssetTypeSourcePanel.add(myBackgroundScalingTitleSeparator,
new GridConstraints(2, 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));
myBackgroundImageOptionsPanel = new JPanel();
myBackgroundImageOptionsPanel.setLayout(new GridLayoutManager(2, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundAllOptionsPanel.add(myBackgroundImageOptionsPanel,
new GridConstraints(4, 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));
myBackgroundTrimRowPanel = new JPanel();
myBackgroundTrimRowPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundTrimRowPanel.setVisible(true);
myBackgroundImageOptionsPanel.add(myBackgroundTrimRowPanel,
new GridConstraints(0, 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));
myBackgroundTrimLabel = new JBLabel();
myBackgroundTrimLabel.setText("Trim:");
myBackgroundTrimRowPanel.add(myBackgroundTrimLabel,
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));
myBackgroundTrimOptionsPanel = new JPanel();
myBackgroundTrimOptionsPanel.setLayout(new GridLayoutManager(1, 3, JBUI.emptyInsets(), -1, -1));
myBackgroundTrimRowPanel.add(myBackgroundTrimOptionsPanel,
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 spacer3 = new Spacer();
myBackgroundTrimOptionsPanel.add(spacer3,
new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
myBackgroundTrimYesRadioButton = new JRadioButton();
myBackgroundTrimYesRadioButton.setText("Yes");
myBackgroundTrimYesRadioButton.setToolTipText("Remove any transparent space from around your source asset before rendering to icon.");
myBackgroundTrimOptionsPanel.add(myBackgroundTrimYesRadioButton,
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));
myBackgroundTrimNoRadioButton = new JRadioButton();
myBackgroundTrimNoRadioButton.setSelected(true);
myBackgroundTrimNoRadioButton.setText("No");
myBackgroundTrimNoRadioButton.setToolTipText("Leave the original asset unmodified.");
myBackgroundTrimOptionsPanel.add(myBackgroundTrimNoRadioButton,
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));
myBackgroundResizeRowPanel = new JPanel();
myBackgroundResizeRowPanel.setLayout(new GridLayoutManager(1, 2, JBUI.emptyInsets(), -1, -1));
myBackgroundResizeRowPanel.setVisible(true);
myBackgroundImageOptionsPanel.add(myBackgroundResizeRowPanel,
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));
myBackgroundResizeLabel = new JBLabel();
myBackgroundResizeLabel.setText("Resize:");
myBackgroundResizeRowPanel.add(myBackgroundResizeLabel,
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));
myBackgroundResizeSliderPanel = new JPanel();
myBackgroundResizeSliderPanel.setLayout(new GridLayoutManager(1, 3, JBUI.emptyInsets(), -1, -1));
myBackgroundResizeRowPanel.add(myBackgroundResizeSliderPanel,
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));
myBackgroundResizeSlider = new JSlider();
myBackgroundResizeSlider.setMaximum(400);
myBackgroundResizeSlider.setMinimum(0);
myBackgroundResizeSlider.setMinorTickSpacing(20);
myBackgroundResizeSlider.setPaintLabels(false);
myBackgroundResizeSlider.setPaintTicks(true);
myBackgroundResizeSlider.setSnapToTicks(false);
myBackgroundResizeSlider.setToolTipText(
"Resize the original asset using the specified scaling factor (in percent). This happens after any trimming.");
myBackgroundResizeSlider.setValue(100);
myBackgroundResizeSliderPanel.add(myBackgroundResizeSlider,
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));
myBackgroundResizeValueTextField = new JTextField();
myBackgroundResizeValueTextField.setHorizontalAlignment(4);
myBackgroundResizeValueTextField.setText("100");
myBackgroundResizeSliderPanel.add(myBackgroundResizeValueTextField,
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));
myBackgroundResizeValueLabel = new JLabel();
myBackgroundResizeValueLabel.setHorizontalAlignment(4);
myBackgroundResizeValueLabel.setText("%");
myBackgroundResizeSliderPanel.add(myBackgroundResizeValueLabel,
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 spacer4 = new Spacer();
myBackgroundAllOptionsPanel.add(spacer4,
new GridConstraints(5, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
}