List of usage examples for javax.swing.event ChangeListener ChangeListener
ChangeListener
From source file:fr.free.hd.servers.gui.FaceView.java
private JPanel createMouth() { JPanel panel = new JPanel(new GridLayout(3, 0)); final JSlider slider = new JSlider(); final JSlider sliderX = new JSlider(); final JSlider sliderY = new JSlider(); slider.setMinimum(0);//from w ww . j a v a 2 s . com slider.setMaximum(1000); slider.setMajorTickSpacing(100); slider.setPaintLabels(true); slider.setPaintTicks(true); slider.setPaintTrack(true); sliderX.setMinimum(-1000); sliderX.setMaximum(1000); sliderX.setMajorTickSpacing(100); sliderX.setPaintLabels(true); sliderX.setPaintTicks(true); sliderX.setPaintTrack(true); sliderY.setMinimum(-1000); sliderY.setMaximum(1000); sliderY.setMajorTickSpacing(100); sliderY.setPaintLabels(true); sliderY.setPaintTicks(true); sliderY.setPaintTrack(true); sliderX.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { face.setMouthXPercent(sliderX.getValue()); updateLabel(); } }); sliderY.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { face.setMouthYPercent(sliderY.getValue()); updateLabel(); } }); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { face.setMouthRatio(slider.getValue()); updateLabel(); } }); panel.add(slider); panel.add(sliderX); panel.add(sliderY); return panel; }
From source file:econtroller.gui.ControllerGUI.java
private void createActSlider() { Box hbox = Box.createHorizontalBox(); actLabel = new JLabel("Act every ", JLabel.CENTER); actValueLabel = new JLabel(String.valueOf(ACT_INIT), JLabel.CENTER); actSecondLabel = new JLabel(" (s)", JLabel.CENTER); actSlider = new JSlider(); actSlider = new JSlider(JSlider.HORIZONTAL, ACT_MIN, ACT_MAX, ACT_INIT); actSlider.setMajorTickSpacing(20);//from ww w . j a v a 2s. c o m actSlider.setMinorTickSpacing(5); actSlider.setPaintLabels(true); actSlider.setPaintTicks(true); actSlider.setPaintTrack(true); actSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent changeEvent) { JSlider source = (JSlider) changeEvent.getSource(); int value = source.getValue(); actValueLabel.setText(String.valueOf(value)); } }); hbox.add(actLabel); hbox.add(actValueLabel); hbox.add(actSecondLabel); controllerDesignPanel.add(hbox); controllerDesignPanel.add(actSlider); }
From source file:net.pms.encoders.VLCVideo.java
@Override public JComponent config() { // Apply the orientation for the locale Locale locale = new Locale(configuration.getLanguage()); ComponentOrientation orientation = ComponentOrientation.getOrientation(locale); String colSpec = FormLayoutUtil.getColSpec("right:pref, 3dlu, pref:grow, 7dlu, right:pref, 3dlu, pref:grow", orientation);/* ww w. ja v a 2 s . c o m*/ FormLayout layout = new FormLayout(colSpec, ""); // Here goes my 3rd try to learn JGoodies Form layout.setColumnGroups(new int[][] { { 1, 5 }, { 3, 7 } }); DefaultFormBuilder mainPanel = new DefaultFormBuilder(layout); mainPanel.appendSeparator(Messages.getString("VlcTrans.1")); mainPanel.append(experimentalCodecs = new JCheckBox(Messages.getString("VlcTrans.3"), configuration.isVlcExperimentalCodecs()), 3); experimentalCodecs.setContentAreaFilled(false); experimentalCodecs.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setVlcExperimentalCodecs(e.getStateChange() == ItemEvent.SELECTED); } }); mainPanel.append(audioSyncEnabled = new JCheckBox(Messages.getString("VlcTrans.4"), configuration.isVlcAudioSyncEnabled()), 3); audioSyncEnabled.setContentAreaFilled(false); audioSyncEnabled.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setVlcAudioSyncEnabled(e.getStateChange() == ItemEvent.SELECTED); } }); mainPanel.nextLine(); // Developer stuff. Theoretically is temporary mainPanel.appendSeparator(Messages.getString("VlcTrans.10")); // Add scale as a subpanel because it has an awkward layout mainPanel.append(Messages.getString("VlcTrans.11")); FormLayout scaleLayout = new FormLayout("pref,3dlu,pref", ""); DefaultFormBuilder scalePanel = new DefaultFormBuilder(scaleLayout); double startingScale = Double.valueOf(configuration.getVlcScale()); scalePanel.append(scale = new JTextField(String.valueOf(startingScale))); final JSlider scaleSlider = new JSlider(JSlider.HORIZONTAL, 0, 10, (int) (startingScale * 10)); scalePanel.append(scaleSlider); scaleSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent ce) { String value = String.valueOf((double) scaleSlider.getValue() / 10); scale.setText(value); configuration.setVlcScale(value); } }); scale.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { String typed = scale.getText(); if (!typed.matches("\\d\\.\\d")) { return; } double value = Double.parseDouble(typed); scaleSlider.setValue((int) (value * 10)); configuration.setVlcScale(String.valueOf(value)); } }); mainPanel.append(scalePanel.getPanel(), 3); // Audio sample rate FormLayout sampleRateLayout = new FormLayout( "right:pref, 3dlu, right:pref, 3dlu, right:pref, 3dlu, left:pref", ""); DefaultFormBuilder sampleRatePanel = new DefaultFormBuilder(sampleRateLayout); sampleRateOverride = new JCheckBox(Messages.getString("VlcTrans.17"), configuration.getVlcSampleRateOverride()); sampleRatePanel.append(Messages.getString("VlcTrans.18"), sampleRateOverride); sampleRate = new JTextField(configuration.getVlcSampleRate(), 8); sampleRate.setEnabled(configuration.getVlcSampleRateOverride()); sampleRate.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { configuration.setVlcSampleRate(sampleRate.getText()); } }); sampleRatePanel.append(Messages.getString("VlcTrans.19"), sampleRate); sampleRateOverride.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { boolean checked = e.getStateChange() == ItemEvent.SELECTED; configuration.setVlcSampleRateOverride(checked); sampleRate.setEnabled(checked); } }); mainPanel.nextLine(); mainPanel.append(sampleRatePanel.getPanel(), 7); // Extra options mainPanel.nextLine(); mainPanel.append(Messages.getString("VlcTrans.20"), extraParams = new JTextField(), 5); return mainPanel.getPanel(); }
From source file:coreferenceresolver.gui.MarkupGUI.java
private JScrollPane newMarkupPanel(NounPhrase np, ReviewElement reviewElement) { //MODEL/* w w w .j a v a 2 s .c o m*/ Element element = new Element(); //Newly added ScrollablePanel markupPanel = new ScrollablePanel(); markupPanel.setLayout(new BoxLayout(markupPanel, BoxLayout.X_AXIS)); markupPanel.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.FIT); JTextArea npContentTxtArea = new JTextArea(); npContentTxtArea.setEditable(false); npContentTxtArea.setText(((MarkupNounPhrase) np).content); markupPanel.add(npContentTxtArea); //REF SpinnerModel refSpinnerModel = new SpinnerNumberModel(np.getChainId(), -1, COLORS.length - 1, 1); JSpinner refSpinner = new JSpinner(refSpinnerModel); refSpinner.setValue(np.getChainId()); refSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { np.setChainId((int) refSpinner.getValue()); try { rePaint(reviewElements.get(np.getReviewId()), np); } catch (BadLocationException ex) { Logger.getLogger(MarkupGUI.class.getName()).log(Level.SEVERE, null, ex); } } }); element.refSpinner = refSpinner; //TYPE String[] typeValues = { "Object", "Other", "Candidate", "Attribute" }; SpinnerModel typeSpinnerModel = new SpinnerListModel(typeValues); JSpinner typeSpinner = new JSpinner(typeSpinnerModel); typeSpinner.setValue(typeValues[np.getType()]); element.typeSpinner = typeSpinner; //REF + TYPE ScrollablePanel spinners = new ScrollablePanel(); spinners.setLayout(new BoxLayout(spinners, BoxLayout.X_AXIS)); spinners.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.FIT); spinners.add(refSpinner); spinners.add(typeSpinner); markupPanel.add(spinners); reviewElement.addElement(element); JScrollPane scrollMarkupPanel = new JScrollPane(markupPanel); return scrollMarkupPanel; }
From source file:edu.ku.brc.af.auth.UserAndMasterPasswordMgr.java
/** * Displays a dialog used for editing the Master Username and Password. * @param isLocal whether u/p is stored locally or not * @param usrName/*from w w w . jav a2s .co m*/ * @param dbName * @param masterPath the path to the password * @return whether to ask for the information because it wasn't found */ protected boolean askForInfo(final Boolean isLocal, final String usrName, final String dbName, final String masterPath) { loadAndPushResourceBundle("masterusrpwd"); FormLayout layout = new FormLayout("p, 2px, f:p:g, 4px, p, 4px, p, 4px, p", "p,2px,p,2px,p,2dlu,p,2dlu,p"); PanelBuilder pb = new PanelBuilder(layout); pb.setDefaultDialogBorder(); ButtonGroup group = new ButtonGroup(); final JRadioButton isNetworkRB = new JRadioButton(getResourceString("IS_NET_BASED")); final JRadioButton isPrefBasedRB = new JRadioButton(getResourceString("IS_ENCRYPTED_KEY")); isPrefBasedRB.setSelected(true); group.add(isNetworkRB); group.add(isPrefBasedRB); final JTextField keyTxt = createTextField(35); final JTextField urlTxt = createTextField(35); final JLabel keyLbl = createI18NFormLabel("ENCRYPTED_USRPWD"); final JLabel urlLbl = createI18NFormLabel("URL"); final JButton createBtn = createI18NButton("CREATE_KEY"); final JButton copyCBBtn = createIconBtn("ClipboardCopy", IconManager.IconSize.Std24, "CPY_TO_CB_TT", null); final JButton pasteCBBtn = createIconBtn("ClipboardPaste", IconManager.IconSize.Std24, "CPY_FROM_CB_TT", null); // retrieves the encrypted key for the current settings in the dialog String dbNameFromForm = AppPreferences.getLocalPrefs().get("login.databases_selected", null); if (isNotEmpty(dbNameFromForm) && isNotEmpty(usersUserName)) { String masterKey = getMasterPrefPath(usersUserName, dbNameFromForm, true); if (isNotEmpty(masterKey)) { String encryptedKey = AppPreferences.getLocalPrefs().get(masterKey, null); if (isNotEmpty(encryptedKey) && !encryptedKey.startsWith("http")) { keyTxt.setText(encryptedKey); } } } CellConstraints cc = new CellConstraints(); int y = 1; pb.add(createI18NFormLabel("MASTER_LOC"), cc.xywh(1, y, 1, 3)); pb.add(isPrefBasedRB, cc.xy(3, y)); y += 2; pb.add(isNetworkRB, cc.xy(3, y)); y += 2; pb.addSeparator("", cc.xyw(1, y, 9)); y += 2; pb.add(keyLbl, cc.xy(1, y)); pb.add(keyTxt, cc.xy(3, y)); pb.add(createBtn, cc.xy(5, y)); pb.add(copyCBBtn, cc.xy(7, y)); pb.add(pasteCBBtn, cc.xy(9, y)); y += 2; pb.add(urlLbl, cc.xy(1, y)); pb.add(urlTxt, cc.xy(3, y)); y += 2; boolean isEditMode = isLocal != null && isNotEmpty(masterPath); if (isEditMode) { isPrefBasedRB.setSelected(isLocal); if (isLocal) { keyTxt.setText(masterPath); } else { urlTxt.setText(masterPath); } } copyCBBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Copy to Clipboard UIHelper.setTextToClipboard(keyTxt.getText()); } }); pasteCBBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { keyTxt.setText(UIHelper.getTextFromClipboard()); } }); final CustomDialog dlg = new CustomDialog((Frame) null, getResourceString("MASTER_TITLE"), true, CustomDialog.OKCANCELHELP, pb.getPanel()); if (!isEditMode) { dlg.setOkLabel(getResourceString("CONT")); dlg.setCancelLabel(getResourceString("BACK")); } dlg.setHelpContext("MASTERPWD_MAIN"); dlg.createUI(); dlg.getOkBtn().setEnabled(false); urlLbl.setEnabled(false); urlTxt.setEnabled(false); copyCBBtn.setEnabled(true); pasteCBBtn.setEnabled(true); DocumentListener dl = new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { dlg.getOkBtn().setEnabled((isPrefBasedRB.isSelected() && !keyTxt.getText().isEmpty()) || (isNetworkRB.isSelected() && !urlTxt.getText().isEmpty())); } }; keyTxt.getDocument().addDocumentListener(dl); urlTxt.getDocument().addDocumentListener(dl); ChangeListener chgListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { boolean isNet = isNetworkRB.isSelected(); keyLbl.setEnabled(!isNet); keyTxt.setEnabled(!isNet); createBtn.setEnabled(!isNet); copyCBBtn.setEnabled(!isNet); pasteCBBtn.setEnabled(!isNet); urlLbl.setEnabled(isNet); urlTxt.setEnabled(isNet); dlg.getOkBtn().setEnabled((isPrefBasedRB.isSelected() && !keyTxt.getText().isEmpty()) || (isNetworkRB.isSelected() && !urlTxt.getText().isEmpty())); } }; isNetworkRB.addChangeListener(chgListener); isPrefBasedRB.addChangeListener(chgListener); boolean isPref = AppPreferences.getLocalPrefs().getBoolean(getIsLocalPrefPath(usrName, dbName, true), true); isNetworkRB.setSelected(!isPref); isPrefBasedRB.setSelected(isPref); createBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String[] keys = getUserNamePasswordKey(); if (keys != null && keys.length == 4) { String encryptedStr = encrypt(keys[0], keys[1], keys[3]); if (encryptedStr != null) { keyTxt.setText(encryptedStr); dlg.getOkBtn().setEnabled(true); usersUserName = keys[2]; } } } }); popResourceBundle(); dlg.setVisible(true); if (!dlg.isCancelled()) { String value; if (isNetworkRB.isSelected()) { value = StringEscapeUtils.escapeHtml(urlTxt.getText()); } else { value = keyTxt.getText(); } AppPreferences.getLocalPrefs().putBoolean(getIsLocalPrefPath(usrName, dbName, true), !isNetworkRB.isSelected()); AppPreferences.getLocalPrefs().put(getMasterPrefPath(usrName, dbName, true), value); return true; } return false; }
From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyMain.java
/** * This method initializes jTabbedPane * /* w w w . j a va 2 s . c om*/ * @return javax.swing.JTabbedPane */ public JTabbedPane getJTabbedPaneFileNavigation() { if (jTabbedPaneFileNavigation == null) { jTabbedPaneFileNavigation = new JTabbedPane(); jTabbedPaneFileNavigation.addTab("Tree", null, getJScrollPaneTree(), null); jTabbedPaneFileNavigation.addTab("List", null, getJScrollPaneList(), null); jTabbedPaneFileNavigation.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); jTabbedPaneFileNavigation.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); int selectedTab = pane.getSelectedIndex(); log.debug("[JPanIdentifyMain.getJTabbedPaneFileNavigation()] selectedTab : " + selectedTab); SelectedFilePathInfo selectedFilePathInfo = IdentifyMediator.getInstance() .getSelectedFilePathInfo(); String selectedPath = selectedFilePathInfo.getSelectedPath(); log.debug("[JPanIdentifyMain.getJTabbedPaneFileNavigation()] selectedPath : " + selectedPath); IdentifyMediator.getInstance().setFilePointerToSelectedFile(selectedPath); actForTab(selectedTab); String projectName = IdentifyMediator.getInstance().getSelectedProjectName(); refreshChildFrameForMatchedType(projectName); } }); } return jTabbedPaneFileNavigation; }
From source file:net.sf.profiler4j.console.ProjectDialog.java
JCheckBox getExportCheckBox() { if (null == exportCheckBox) { exportCheckBox = new JCheckBox(); exportCheckBox.setSelected(false); exportCheckBox.setText("Export call graph on each snapshot"); exportCheckBox.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { exportPatternText.setEnabled(exportCheckBox.isSelected()); }/*from ww w .j av a2 s . com*/ }); } return exportCheckBox; }
From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java
private final JPanel buildBottomPanel() { JPanel panel = new JPanel(new BorderLayout()); JTabbedPane tabbedPane = new JTabbedPane(); Dimension size = new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT / 10); panel.setSize(size);//from w w w . j av a2 s . com panel.setPreferredSize(size); tabbedPane.add("Symbol Profiling", new JScrollPane(profilingSymbolTable)); tabbedPane.add("Message Profiling", new JScrollPane(profilingMsgTable)); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { profilingSymbolTable.clearSelection(); profilingMsgTable.clearSelection(); } }); panel.add(tabbedPane); return panel; }
From source file:com.dragoniade.deviantart.ui.PreferencesDialog.java
public PreferencesDialog(final DownloaderGUI owner, Properties config) { super(owner, "Preferences", true); HttpClientParams params = new HttpClientParams(); params.setVersion(HttpVersion.HTTP_1_1); params.setSoTimeout(30000);//from w w w . jav a 2s. c om client = new HttpClient(params); setProxy(ProxyCfg.parseConfig(config)); sample = new Deviation(); sample.setId(15972367L); sample.setTitle("Fella Promo"); sample.setArtist("devart"); sample.setImageDownloadUrl(DOWNLOAD_URL); sample.setImageFilename(Deviation.extractFilename(DOWNLOAD_URL)); sample.setCollection(new Collection(1L, "MyCollect")); setLayout(new BorderLayout()); panes = new JTabbedPane(JTabbedPane.TOP); JPanel genPanel = new JPanel(); BoxLayout genLayout = new BoxLayout(genPanel, BoxLayout.Y_AXIS); genPanel.setLayout(genLayout); panes.add("General", genPanel); JLabel userLabel = new JLabel("Username"); userLabel.setToolTipText("The username the account you want to download the favorites from."); userField = new JTextField(config.getProperty(Constants.USERNAME)); userLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); userLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); userField.setAlignmentX(JLabel.LEFT_ALIGNMENT); userField.setMaximumSize(new Dimension(Integer.MAX_VALUE, userField.getFont().getSize() * 2)); genPanel.add(userLabel); genPanel.add(userField); JPanel radioPanel = new JPanel(); BoxLayout radioLayout = new BoxLayout(radioPanel, BoxLayout.X_AXIS); radioPanel.setAlignmentX(JLabel.LEFT_ALIGNMENT); radioPanel.setBorder(new EmptyBorder(0, 5, 0, 5)); radioPanel.setLayout(radioLayout); JLabel searchLabel = new JLabel("Search for"); searchLabel .setToolTipText("Select what you want to download from that user: it favorites or it galleries."); searchLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); searchLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); selectedSearch = SEARCH.lookup(config.getProperty(Constants.SEARCH, SEARCH.getDefault().getId())); buttonGroup = new ButtonGroup(); for (final SEARCH search : SEARCH.values()) { JRadioButton radio = new JRadioButton(search.getLabel()); radio.setAlignmentX(JLabel.LEFT_ALIGNMENT); radio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectedSearch = search; } }); buttonGroup.add(radio); radioPanel.add(radio); if (search.equals(selectedSearch)) { radio.setSelected(true); } } genPanel.add(radioPanel); final JTextField sampleField = new JTextField(""); sampleField.setEditable(false); JLabel locationLabel = new JLabel("Download location"); locationLabel.setToolTipText("The folder pattern where you want the file to be downloaded in."); JLabel legendsLabel = new JLabel( "<html><body>Field names: %user%, %artist%, %title%, %id%, %filename%, %collection%, %ext%<br></br>Example:</body></html>"); legendsLabel.setToolTipText("An example of where a file will be downloaded to."); locationString = new StringBuilder(); locationField = new JTextField(config.getProperty(Constants.LOCATION)); locationField.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } public void keyReleased(KeyEvent e) { File dest = LocationHelper.getFile(locationField.getText(), userField.getText(), sample, sample.getImageFilename()); locationString.setLength(0); locationString.append(dest.getAbsolutePath()); sampleField.setText(locationString.toString()); if (useSameForMatureBox.isSelected()) { locationMatureString.setLength(0); locationMatureString.append(sampleField.getText()); locationMatureField.setText(locationField.getText()); } } public void keyTyped(KeyEvent e) { } }); locationField.addMouseListener(new MouseListener() { public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseExited(MouseEvent e) { sampleField.setText(locationString.toString()); } public void mouseEntered(MouseEvent e) { sampleField.setText(locationString.toString()); } public void mouseClicked(MouseEvent e) { } }); JLabel locationMatureLabel = new JLabel("Mature download location"); locationMatureLabel.setToolTipText( "The folder pattern where you want the file marked as 'Mature' to be downloaded in."); locationMatureString = new StringBuilder(); locationMatureField = new JTextField(config.getProperty(Constants.MATURE)); locationMatureField.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } public void keyReleased(KeyEvent e) { File dest = LocationHelper.getFile(locationMatureField.getText(), userField.getText(), sample, sample.getImageFilename()); locationMatureString.setLength(0); locationMatureString.append(dest.getAbsolutePath()); sampleField.setText(locationMatureString.toString()); } public void keyTyped(KeyEvent e) { } }); locationMatureField.addMouseListener(new MouseListener() { public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseExited(MouseEvent e) { sampleField.setText(locationString.toString()); } public void mouseEntered(MouseEvent e) { sampleField.setText(locationMatureString.toString()); } public void mouseClicked(MouseEvent e) { } }); useSameForMatureBox = new JCheckBox("Use same location for mature deviation?"); useSameForMatureBox.setSelected(locationLabel.getText().equals(locationMatureField.getText())); useSameForMatureBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (useSameForMatureBox.isSelected()) { locationMatureField.setEditable(false); locationMatureField.setText(locationField.getText()); locationMatureString.setLength(0); locationMatureString.append(locationString); } else { locationMatureField.setEditable(true); } } }); File dest = LocationHelper.getFile(locationField.getText(), userField.getText(), sample, sample.getImageFilename()); sampleField.setText(dest.getAbsolutePath()); locationString.append(sampleField.getText()); dest = LocationHelper.getFile(locationMatureField.getText(), userField.getText(), sample, sample.getImageFilename()); locationMatureString.append(dest.getAbsolutePath()); locationLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); locationLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); locationField.setAlignmentX(JLabel.LEFT_ALIGNMENT); locationField.setMaximumSize(new Dimension(Integer.MAX_VALUE, locationField.getFont().getSize() * 2)); locationMatureLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); locationMatureLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); locationMatureField.setAlignmentX(JLabel.LEFT_ALIGNMENT); locationMatureField .setMaximumSize(new Dimension(Integer.MAX_VALUE, locationMatureField.getFont().getSize() * 2)); useSameForMatureBox.setAlignmentX(JLabel.LEFT_ALIGNMENT); legendsLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); legendsLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); legendsLabel.setMaximumSize(new Dimension(Integer.MAX_VALUE, legendsLabel.getFont().getSize() * 2)); sampleField.setAlignmentX(JLabel.LEFT_ALIGNMENT); sampleField.setMaximumSize(new Dimension(Integer.MAX_VALUE, sampleField.getFont().getSize() * 2)); genPanel.add(locationLabel); genPanel.add(locationField); genPanel.add(locationMatureLabel); genPanel.add(locationMatureField); genPanel.add(useSameForMatureBox); genPanel.add(legendsLabel); genPanel.add(sampleField); genPanel.add(Box.createVerticalBox()); final KeyListener prxChangeListener = new KeyListener() { public void keyTyped(KeyEvent e) { proxyChangeState = true; } public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { } }; JPanel prxPanel = new JPanel(); BoxLayout prxLayout = new BoxLayout(prxPanel, BoxLayout.Y_AXIS); prxPanel.setLayout(prxLayout); panes.add("Proxy", prxPanel); JLabel prxHostLabel = new JLabel("Proxy Host"); prxHostLabel.setToolTipText("The hostname of the proxy server"); prxHostField = new JTextField(config.getProperty(Constants.PROXY_HOST)); prxHostLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); prxHostLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); prxHostField.setAlignmentX(JLabel.LEFT_ALIGNMENT); prxHostField.setMaximumSize(new Dimension(Integer.MAX_VALUE, prxHostField.getFont().getSize() * 2)); JLabel prxPortLabel = new JLabel("Proxy Port"); prxPortLabel.setToolTipText("The port of the proxy server (Default 80)."); prxPortSpinner = new JSpinner(); prxPortSpinner.setModel(new SpinnerNumberModel( Integer.parseInt(config.getProperty(Constants.PROXY_PORT, "80")), 1, 65535, 1)); prxPortLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); prxPortLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); prxPortSpinner.setAlignmentX(JLabel.LEFT_ALIGNMENT); prxPortSpinner.setMaximumSize(new Dimension(Integer.MAX_VALUE, prxPortSpinner.getFont().getSize() * 2)); JLabel prxUserLabel = new JLabel("Proxy username"); prxUserLabel.setToolTipText("The username used for authentication, if applicable."); prxUserField = new JTextField(config.getProperty(Constants.PROXY_USERNAME)); prxUserLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); prxUserLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); prxUserField.setAlignmentX(JLabel.LEFT_ALIGNMENT); prxUserField.setMaximumSize(new Dimension(Integer.MAX_VALUE, prxUserField.getFont().getSize() * 2)); JLabel prxPassLabel = new JLabel("Proxy username"); prxPassLabel.setToolTipText("The username used for authentication, if applicable."); prxPassField = new JPasswordField(config.getProperty(Constants.PROXY_PASSWORD)); prxPassLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); prxPassLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); prxPassField.setAlignmentX(JLabel.LEFT_ALIGNMENT); prxPassField.setMaximumSize(new Dimension(Integer.MAX_VALUE, prxPassField.getFont().getSize() * 2)); prxUseBox = new JCheckBox("Use a proxy?"); prxUseBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { prxChangeListener.keyTyped(null); if (prxUseBox.isSelected()) { prxHostField.setEditable(true); prxPortSpinner.setEnabled(true); prxUserField.setEditable(true); prxPassField.setEditable(true); } else { prxHostField.setEditable(false); prxPortSpinner.setEnabled(false); prxUserField.setEditable(false); prxPassField.setEditable(false); } } }); prxUseBox.setSelected(!Boolean.parseBoolean(config.getProperty(Constants.PROXY_USE))); prxUseBox.doClick(); proxyChangeState = false; prxHostField.addKeyListener(prxChangeListener); prxUserField.addKeyListener(prxChangeListener); prxPassField.addKeyListener(prxChangeListener); prxPortSpinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { proxyChangeState = true; } }); prxPanel.add(prxUseBox); prxPanel.add(prxHostLabel); prxPanel.add(prxHostField); prxPanel.add(prxPortLabel); prxPanel.add(prxPortSpinner); prxPanel.add(prxUserLabel); prxPanel.add(prxUserField); prxPanel.add(prxPassLabel); prxPanel.add(prxPassField); prxPanel.add(Box.createVerticalBox()); final JPanel advPanel = new JPanel(); BoxLayout advLayout = new BoxLayout(advPanel, BoxLayout.Y_AXIS); advPanel.setLayout(advLayout); panes.add("Advanced", advPanel); panes.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); if (proxyChangeState && pane.getSelectedComponent() == advPanel) { Properties properties = new Properties(); properties.setProperty(Constants.PROXY_USERNAME, prxUserField.getText().trim()); properties.setProperty(Constants.PROXY_PASSWORD, new String(prxPassField.getPassword()).trim()); properties.setProperty(Constants.PROXY_HOST, prxHostField.getText().trim()); properties.setProperty(Constants.PROXY_PORT, prxPortSpinner.getValue().toString()); properties.setProperty(Constants.PROXY_USE, Boolean.toString(prxUseBox.isSelected())); ProxyCfg prx = ProxyCfg.parseConfig(properties); setProxy(prx); revalidateSearcher(null); } } }); JLabel domainLabel = new JLabel("Deviant Art domain name"); domainLabel.setToolTipText("The deviantART main domain, should it ever change."); domainField = new JTextField(config.getProperty(Constants.DOMAIN)); domainLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); domainLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); domainField.setAlignmentX(JLabel.LEFT_ALIGNMENT); domainField.setMaximumSize(new Dimension(Integer.MAX_VALUE, domainField.getFont().getSize() * 2)); advPanel.add(domainLabel); advPanel.add(domainField); JLabel throttleLabel = new JLabel("Throttle search delay"); throttleLabel.setToolTipText( "Slow down search query by inserting a pause between them. This help prevent abuse when doing a massive download."); throttleSpinner = new JSpinner(); throttleSpinner.setModel( new SpinnerNumberModel(Integer.parseInt(config.getProperty(Constants.THROTTLE, "0")), 5, 60, 1)); throttleLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); throttleLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); throttleSpinner.setAlignmentX(JLabel.LEFT_ALIGNMENT); throttleSpinner.setMaximumSize(new Dimension(Integer.MAX_VALUE, throttleSpinner.getFont().getSize() * 2)); advPanel.add(throttleLabel); advPanel.add(throttleSpinner); JLabel searcherLabel = new JLabel("Searcher"); searcherLabel.setToolTipText("Select a searcher that will look for your favorites."); searcherBox = new JComboBox(); searcherBox.setRenderer(new TogglingRenderer()); final AtomicInteger index = new AtomicInteger(0); searcherBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox combo = (JComboBox) e.getSource(); Object selectedItem = combo.getSelectedItem(); if (selectedItem instanceof SearchItem) { SearchItem item = (SearchItem) selectedItem; if (item.isValid) { index.set(combo.getSelectedIndex()); } else { combo.setSelectedIndex(index.get()); } } } }); try { for (Class<Search> clazz : SearcherClassCache.getInstance().getClasses()) { Search searcher = clazz.newInstance(); String name = searcher.getName(); SearchItem item = new SearchItem(name, clazz.getName(), true); searcherBox.addItem(item); } String selectedClazz = config.getProperty(Constants.SEARCHER, com.dragoniade.deviantart.deviation.SearchRss.class.getName()); revalidateSearcher(selectedClazz); } catch (Exception e1) { throw new RuntimeException(e1); } searcherLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); searcherLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); searcherBox.setAlignmentX(JLabel.LEFT_ALIGNMENT); searcherBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, searcherBox.getFont().getSize() * 2)); advPanel.add(searcherLabel); advPanel.add(searcherBox); advPanel.add(Box.createVerticalBox()); add(panes, BorderLayout.CENTER); JButton saveBut = new JButton("Save"); userField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { JTextField field = (JTextField) input; if (field.getText().trim().length() == 0) { JOptionPane.showMessageDialog(input, "The user musn't be empty.", "Warning", JOptionPane.WARNING_MESSAGE); return false; } return true; } }); locationField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { JTextField field = (JTextField) input; String content = field.getText().trim(); if (content.length() == 0) { JOptionPane.showMessageDialog(input, "The location musn't be empty.", "Warning", JOptionPane.WARNING_MESSAGE); return false; } if (!content.contains("%filename%") && !content.contains("%id%")) { JOptionPane.showMessageDialog(input, "The location must contains at least a %filename% or an %id% field.", "Warning", JOptionPane.WARNING_MESSAGE); return false; } return true; } }); locationMatureField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { JTextField field = (JTextField) input; String content = field.getText().trim(); if (content.length() == 0) { JOptionPane.showMessageDialog(input, "The Mature location musn't be empty.", "Warning", JOptionPane.WARNING_MESSAGE); return false; } if (!content.contains("%filename%") && !content.contains("%id%")) { JOptionPane.showMessageDialog(input, "The Mature location must contains at least a %username% or an %id% field.", "Warning", JOptionPane.WARNING_MESSAGE); return false; } return true; } }); domainField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { JTextField field = (JTextField) input; String domain = field.getText().trim(); if (domain.length() == 0) { JOptionPane.showMessageDialog(input, "You must specify the deviantART main domain.", "Warning", JOptionPane.WARNING_MESSAGE); return false; } if (domain.toLowerCase().startsWith("http://")) { JOptionPane.showMessageDialog(input, "You must specify the deviantART main domain, not the full URL (aka www.deviantart.com).", "Warning", JOptionPane.WARNING_MESSAGE); return false; } return true; } }); locationField.setVerifyInputWhenFocusTarget(true); final JDialog parent = this; saveBut.addActionListener(new ActionListener() { String errorMsg = "The location is invalid or cannot be written to."; public void actionPerformed(ActionEvent e) { String username = userField.getText().trim(); String location = locationField.getText().trim(); String locationMature = locationMatureField.getText().trim(); String domain = domainField.getText().trim(); String throttle = throttleSpinner.getValue().toString(); String searcher = searcherBox.getSelectedItem().toString(); String prxUse = Boolean.toString(prxUseBox.isSelected()); String prxHost = prxHostField.getText().trim(); String prxPort = prxPortSpinner.getValue().toString(); String prxUsername = prxUserField.getText().trim(); String prxPassword = new String(prxPassField.getPassword()).trim(); if (!testPath(location, username)) { JOptionPane.showMessageDialog(parent, errorMsg, "Error", JOptionPane.ERROR_MESSAGE); } if (!testPath(locationMature, username)) { JOptionPane.showMessageDialog(parent, errorMsg, "Error", JOptionPane.ERROR_MESSAGE); } Properties p = new Properties(); p.setProperty(Constants.USERNAME, username); p.setProperty(Constants.LOCATION, location); p.setProperty(Constants.MATURE, locationMature); p.setProperty(Constants.DOMAIN, domain); p.setProperty(Constants.THROTTLE, throttle); p.setProperty(Constants.SEARCHER, searcher); p.setProperty(Constants.SEARCH, selectedSearch.getId()); p.setProperty(Constants.PROXY_USE, prxUse); p.setProperty(Constants.PROXY_HOST, prxHost); p.setProperty(Constants.PROXY_PORT, prxPort); p.setProperty(Constants.PROXY_USERNAME, prxUsername); p.setProperty(Constants.PROXY_PASSWORD, prxPassword); owner.savePreferences(p); parent.dispose(); } }); JButton cancelBut = new JButton("Cancel"); cancelBut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { parent.dispose(); } }); JPanel buttonPanel = new JPanel(); BoxLayout butLayout = new BoxLayout(buttonPanel, BoxLayout.X_AXIS); buttonPanel.setLayout(butLayout); buttonPanel.add(saveBut); buttonPanel.add(cancelBut); add(buttonPanel, BorderLayout.SOUTH); pack(); setResizable(false); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2); setVisible(true); }
From source file:edu.ku.brc.af.ui.db.DatabaseLoginPanel.java
/** * Creates the UI for the login and hooks up any listeners. * @param isDlg whether the parent is a dialog (false mean JFrame) * @param iconName the icon that will be shown in the panel * @param engageUPPrefs whether it should load and save the username password into the prefs * @param helpContext the help context to use. *//*w w w . jav a 2 s. co m*/ protected void createUI(final boolean isDlg, final String iconName, final String helpContext) { final boolean isNotEmbedded = !DBConnection.getInstance().isEmbedded() && !UIRegistry.isMobile(); final AppPreferences localPrefs = AppPreferences.getLocalPrefs(); //Font cachedFont = UIManager.getFont("JLabel.font"); SkinItem skinItem = SkinsMgr.getSkinItem("LoginPanel"); if (skinItem != null) { skinItem.pushFG("Label.foreground"); } if (isNotEmbedded) { SpinnerModel portModel = new SpinnerNumberModel(3306, //initial value 0, //min Integer.MAX_VALUE, //max 1); //step portSpinner = new JSpinner(portModel); JSpinner.NumberEditor editor = new JSpinner.NumberEditor(portSpinner, "#"); portSpinner.setEditor(editor); portSpinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { DatabaseDriverInfo drvInfo = dbDrivers.get(dbDriverCBX.getSelectedIndex()); if (drvInfo != null && isNotEmbedded && portSpinner != null) { drvInfo.setPort((Integer) portSpinner.getValue()); } } }); setControlSize(portSpinner); } // First create the controls and hook up listeners dbPickList = new PropertiesPickListAdapter("login.databases"); //$NON-NLS-1$ svPickList = new PropertiesPickListAdapter("login.servers"); //$NON-NLS-1$ username = createTextField(15); password = createPasswordField(15); FocusAdapter focusAdp = new FocusAdapter() { @Override public void focusGained(FocusEvent e) { super.focusGained(e); JTextField tf = (JTextField) e.getSource(); tf.selectAll(); } }; username.addFocusListener(focusAdp); password.addFocusListener(focusAdp); databases = new ValComboBox(dbPickList); if (databases.getComboBox() instanceof Java2sAutoComboBox) { ((Java2sAutoComboBox) databases.getComboBox()).setCaseSensitive(true); } servers = new ValComboBox(svPickList); dbPickList.setComboBox(databases); svPickList.setComboBox(servers); setControlSize(password); setControlSize(databases); setControlSize(servers); if (masterUsrPwdProvider != null) { editKeyInfoBtn = UIHelper.createI18NButton("CONFIG_MSTR_KEY"); editKeyInfoBtn.setIcon(IconManager.getIcon("Key", IconManager.IconSize.Std20)); editKeyInfoBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (masterUsrPwdProvider != null && databases != null) { String itemName = null; if (databases.getComboBox().getSelectedItem() instanceof String) { itemName = (String) databases.getComboBox().getSelectedItem(); } else { PickListItemIFace pli = (PickListItemIFace) databases.getComboBox().getSelectedItem(); if (pli != null && pli.getValue() != null) { itemName = pli.getValue(); } } if (itemName != null) { masterUsrPwdProvider.editMasterInfo(username.getText(), itemName, false); } } } }); } rememberUsernameCBX = createCheckBox(getResourceString("rememberuser")); //$NON-NLS-1$ rememberUsernameCBX.setEnabled(engageUPPrefs); statusBar = new JStatusBar(); statusBar.setErrorIcon(IconManager.getIcon("Error", IconManager.IconSize.Std16)); //$NON-NLS-1$ cancelBtn = createButton(getResourceString("CANCEL")); //$NON-NLS-1$ loginBtn = createButton(getResourceString("Login")); //$NON-NLS-1$ helpBtn = createButton(getResourceString("HELP")); //$NON-NLS-1$ forwardImgIcon = IconManager.getIcon("Forward"); //$NON-NLS-1$ downImgIcon = IconManager.getIcon("Down"); //$NON-NLS-1$ moreBtn = new JCheckBox(getResourceString("LOGIN_DLG_MORE"), forwardImgIcon); // XXX I18N //$NON-NLS-1$ setControlSize(moreBtn); // Extra dbDrivers = DatabaseDriverInfo.getDriversList(); dbDriverCBX = createComboBox(dbDrivers); dbDriverCBX.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateUIControls(); DatabaseDriverInfo drvInfo = dbDrivers.get(dbDriverCBX.getSelectedIndex()); if (drvInfo != null && isNotEmbedded && portSpinner != null) { Integer defPort = drvInfo.getPortAsInt(); int portFromPref = localPrefs.getInt(LOGIN_PORT, defPort); portSpinner.setValue(portFromPref); drvInfo.setPort(portFromPref); } } }); if (dbDrivers.size() > 0) { if (dbDrivers.size() == 1) { dbDriverCBX.setSelectedIndex(0); dbDriverCBX.setEnabled(false); } else { String selectedStr = localPrefs.get("login.dbdriver_selected", "MySQL"); //$NON-NLS-1$ //$NON-NLS-2$ int inx = Collections.binarySearch(dbDrivers, new DatabaseDriverInfo(selectedStr, null, null, false, null)); dbDriverCBX.setSelectedIndex(inx > -1 ? inx : -1); } } else { JOptionPane.showConfirmDialog(null, getResourceString("NO_DBDRIVERS"), //$NON-NLS-1$ getResourceString("NO_DBDRIVERS_TITLE"), JOptionPane.CLOSED_OPTION); //$NON-NLS-1$ System.exit(1); } addFocusListenerForTextComp(username); addFocusListenerForTextComp(password); addKeyListenerFor(username, !isDlg); addKeyListenerFor(password, !isDlg); addKeyListenerFor(databases.getTextField(), !isDlg); addKeyListenerFor(servers.getTextField(), !isDlg); if (!isDlg) { addKeyListenerFor(loginBtn, true); } rememberUsernameCBX.setSelected(engageUPPrefs ? localPrefs.getBoolean("login.rememberuser", false) : false); //$NON-NLS-1$ cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (dbListener != null) { dbListener.cancelled(); } } }); loginBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doLogin(); } }); HelpMgr.registerComponent(helpBtn, helpContext); //$NON-NLS-1$ moreBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (extraPanel.isVisible()) { if (dbDriverCBX.getSelectedIndex() != -1) { extraPanel.setVisible(false); moreBtn.setIcon(forwardImgIcon); } } else { extraPanel.setVisible(true); moreBtn.setIcon(downImgIcon); } if (window != null) { window.pack(); } } }); // Ask the PropertiesPickListAdapter to set the index from the prefs dbPickList.setSelectedIndex(); svPickList.setSelectedIndex(); servers.getTextField().addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { updateUIControls(); } }); databases.getTextField().addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { updateUIControls(); } }); databases.getTextField().addFocusListener(new FocusAdapter() { String server = null; private String getServerStr() { String serverStr = null; Object serverObj = servers.getValue(); if (serverObj != null) { serverStr = serverObj.toString(); } return serverStr; } @Override public void focusGained(FocusEvent e) { server = getServerStr(); } @Override public void focusLost(FocusEvent e) { if (server != null) { String newVal = getServerStr(); if (newVal != null && !newVal.equals(server)) { setUsrPwdControlsFromPrefs(); } } } }); setUsrPwdControlsFromPrefs(); // Layout the form PanelBuilder formBuilder = new PanelBuilder(new FormLayout("p,3dlu,p:g", "p,2dlu,p,2dlu,p,2dlu,p,2dlu,p")); //$NON-NLS-1$ //$NON-NLS-2$ CellConstraints cc = new CellConstraints(); formBuilder.addSeparator(getResourceString("LOGINLABEL"), cc.xywh(1, 1, 3, 1)); //$NON-NLS-1$ addLine("username", username, formBuilder, cc, 3); //$NON-NLS-1$ addLine("password", password, formBuilder, cc, 5); //$NON-NLS-1$ formBuilder.add(moreBtn, cc.xy(3, 7)); PanelBuilder extraPanelBlder = new PanelBuilder(new FormLayout("p,3dlu,p:g", //$NON-NLS-1$ UIHelper.createDuplicateJGoodiesDef("p", "2dlu", isNotEmbedded ? 9 : 11))); //$NON-NLS-1$ //$NON-NLS-2$ extraPanel = extraPanelBlder.getPanel(); extraPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 4, 2)); //extraPanelBlder.addSeparator("", cc.xywh(1, 1, 3, 1)); //$NON-NLS-1$ int y = 1; y = addLine(null, rememberUsernameCBX, extraPanelBlder, cc, y); y = addLine("databases", databases, extraPanelBlder, cc, y); //$NON-NLS-1$ y = addLine("servers", servers, extraPanelBlder, cc, y); //$NON-NLS-1$ y = addLine("driver", dbDriverCBX, extraPanelBlder, cc, y); //$NON-NLS-1$ if (isNotEmbedded) { y = addLine("port", portSpinner, extraPanelBlder, cc, y); //$NON-NLS-1$ } if (editKeyInfoBtn != null) { PanelBuilder pb = new PanelBuilder(new FormLayout("p,f:p:g", "p")); pb.add(editKeyInfoBtn, cc.xy(1, 1)); y = addLine(null, pb.getPanel(), extraPanelBlder, cc, y); pb.getPanel().setOpaque(false); } extraPanel.setVisible(false); formBuilder.add(extraPanelBlder.getPanel(), cc.xywh(3, 9, 1, 1)); PanelBuilder outerPanel = new PanelBuilder(new FormLayout("p,3dlu,p:g", "t:p,2dlu,p,2dlu,p"), this); //$NON-NLS-1$ //$NON-NLS-2$ JLabel icon = StringUtils.isNotEmpty(iconName) ? new JLabel(IconManager.getIcon(iconName)) : null; if (icon != null) { icon.setBorder(BorderFactory.createEmptyBorder(10, 10, 2, 2)); } formBuilder.getPanel().setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5)); if (icon != null) { outerPanel.add(icon, cc.xy(1, 1)); } JPanel btnPanel = ButtonBarFactory.buildOKCancelHelpBar(loginBtn, cancelBtn, helpBtn); outerPanel.add(formBuilder.getPanel(), cc.xy(3, 1)); outerPanel.add(btnPanel, cc.xywh(1, 3, 3, 1)); outerPanel.add(statusBar, cc.xywh(1, 5, 3, 1)); formBuilder.getPanel().setOpaque(false); outerPanel.getPanel().setOpaque(false); btnPanel.setOpaque(false); updateUIControls(); if (skinItem != null) { skinItem.popFG("Label.foreground"); } if (AppPreferences.getLocalPrefs().getBoolean(expandExtraPanelName, false)) { extraPanel.setVisible(true); moreBtn.setIcon(downImgIcon); } }