List of usage examples for javax.swing JPanel invalidate
@Override public void invalidate()
From source file:openlr.mapviewer.coding.ui.AbstractCodingOptionsDialog.java
/** * Sets up the form and sets the values from the given configuration. * //from www .j a v a 2 s .c o m * @param config * The configuration to initialize the form with * @return The panel containing the form */ private JComponent buildForm(final FileConfiguration config) { JPanel formPanel = new JPanel(); JScrollPane scrollPane = new JScrollPane(formPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); formPanel.setLayout(new MigLayout("insets 0", "[grow][]", "")); SortedMap<String, List<ConfigEntry>> topicsToKeyValuesMap = buildConfigurationMap(config); for (Map.Entry<String, List<ConfigEntry>> entry : topicsToKeyValuesMap.entrySet()) { String topic = entry.getKey(); List<ConfigEntry> configEntries = entry.getValue(); if (configEntries.size() == 1) { // it is a single property, just put a single line of label and // value directly on the formPanel addLabelledFields(configEntries, formPanel); } else { // multiple sub properties, create a separate panel collecting // all elements JPanel topicPanel = new JPanel(); topicPanel.setLayout(new MigLayout("insets 0", "[grow][]", "")); topicPanel.setBorder(BorderFactory.createTitledBorder(topic)); addLabelledFields(configEntries, topicPanel); formPanel.add(topicPanel, "span, grow, wrap"); } } formPanel.invalidate(); return scrollPane; }
From source file:org.codinjutsu.tools.mongo.view.AbstractAddDialog.java
void initCombo(final ComboBox combobox, final JPanel parentPanel) { combobox.setModel(new DefaultComboBoxModel(JsonDataType.values())); combobox.setRenderer(new ColoredListCellRenderer() { @Override//from w w w . j av a 2s. com protected void customizeCellRenderer(JList jList, Object o, int i, boolean b, boolean b2) { append(((JsonDataType) o).type); } }); combobox.setSelectedItem(null); combobox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent itemEvent) { JsonDataType selectedType = (JsonDataType) combobox.getSelectedItem(); currentEditor = UI_COMPONENT_BY_JSON_DATATYPE.get(selectedType); currentEditor.reset(); parentPanel.invalidate(); parentPanel.removeAll(); parentPanel.add(currentEditor.getComponent(), BorderLayout.CENTER); parentPanel.validate(); } }); combobox.setSelectedItem(JsonDataType.STRING); }
From source file:tvbrowser.ui.mainframe.MainFrame.java
public void updateToolbar() { JPanel contentPane = (JPanel) getContentPane(); if (mToolBarPanel != null) { contentPane.remove(mToolBarPanel); }/* www . j a v a2s .c om*/ mToolBarModel = DefaultToolBarModel.getInstance(); mToolBar = new ToolBar(mToolBarModel); mToolBar.setOpaque(false); String location = mToolBar.getToolbarLocation(); if (Settings.propIsToolbarVisible.getBoolean()) { if (mToolBarPanel == null) { mToolBarPanel = new JPanel(new BorderLayout()) { public void updateUI() { super.updateUI(); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, getBackground().darker())); } }; addContextMenuMouseListener(mToolBarPanel); mSearchField = new SearchField(); } else { mToolBarPanel.removeAll(); } if (location.compareTo(BorderLayout.NORTH) == 0) { mToolBarPanel.add(MoreButton.wrapToolBar(mToolBar, this), BorderLayout.CENTER); if (Settings.propIsSearchFieldVisible.getBoolean()) { mToolBarPanel.add(mSearchField, BorderLayout.EAST); } } else { mToolBarPanel.add(MoreButton.wrapToolBar(mToolBar, this), BorderLayout.WEST); if (Settings.propIsSearchFieldVisible.getBoolean()) { mToolBarPanel.add(mSearchField, BorderLayout.SOUTH); } } contentPane.add(mToolBarPanel, location); } contentPane.invalidate(); contentPane.updateUI(); }
From source file:tvbrowser.ui.mainframe.MainFrame.java
/** * Makes the StatusBar visible//from w w w .j a va 2s .c o m * * @param visible * true if Statusbar should be visible */ public void setShowStatusbar(boolean visible) { JPanel contentPane = (JPanel) getContentPane(); Settings.propIsStatusbarVisible.setBoolean(visible); if (visible && !contentPane.isAncestorOf(mStatusBar)) { jcontentPane.add(mStatusBar, BorderLayout.SOUTH); } else if (contentPane.isAncestorOf(mStatusBar)) { jcontentPane.remove(mStatusBar); } contentPane.invalidate(); contentPane.repaint(); }