Java Code Examples for javax.swing.JPanel.removeAll()
The following are Jave code examples for showing how to use
removeAll() of the
javax.swing.JPanel
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: freecol File: EndTurnDialog.java View Source Code | 6 votes |
/** * {@inheritDoc} */ @Override public Component getListCellRendererComponent(JList<? extends UnitWrapper> list, UnitWrapper value, int index, boolean isSelected, boolean cellHasFocus) { imageLabel.setIcon(new ImageIcon( getImageLibrary().getSmallerUnitImage(value.unit))); nameLabel.setText(value.name); locationLabel.setText(value.location); JPanel panel = (isSelected) ? selectedPanel : itemPanel; panel.removeAll(); panel.add(imageLabel, "center, width 40!, height 40!"); panel.add(nameLabel, "split 2, flowy"); panel.add(locationLabel); return panel; }
Example 2
Project: NBANDROID-V2 File: AndroidSdkNode.java View Source Code | 6 votes |
@Override public void sdkValid() { fireIconChange(); fireOpenedIconChange(); setChildren(Children.create(new AndroidPlatformChildrenFactory(platform, holder), false)); JPanel tmp = lastBrokenPanel.get(); if (tmp != null) { tmp.removeAll(); tmp.invalidate(); tmp.repaint(); tmp.setLayout(new java.awt.CardLayout()); tmp.add(new AndroidSdkCustomizer(platform, holder)); tmp.revalidate(); tmp.repaint(); tmp.requestFocus(); } }
Example 3
Project: NBANDROID-V2 File: AndroidSdkNode.java View Source Code | 6 votes |
public void updateCustomizer() { if (valid != platform.isValid()) { valid = platform.isValid(); setChildren(Children.create(new AndroidPlatformChildrenFactory(platform, holder), false)); JPanel tmp = lastBrokenPanel.get(); if (tmp != null) { tmp.removeAll(); tmp.invalidate(); tmp.repaint(); tmp.setLayout(new java.awt.CardLayout()); if (platform.isValid()) { tmp.add(new AndroidSdkCustomizer(platform, holder)); } else { tmp.add(new BrokenPlatformCustomizer(platform, holder, this)); } tmp.revalidate(); tmp.repaint(); tmp.requestFocus(); } } }
Example 4
Project: FreeCol File: EndTurnDialog.java View Source Code | 6 votes |
/** * {@inheritDoc} */ @Override public Component getListCellRendererComponent(JList<? extends UnitWrapper> list, UnitWrapper value, int index, boolean isSelected, boolean cellHasFocus) { imageLabel.setIcon(new ImageIcon( getImageLibrary().getSmallerUnitImage(value.unit))); nameLabel.setText(value.name); locationLabel.setText(value.location); JPanel panel = (isSelected) ? selectedPanel : itemPanel; panel.removeAll(); panel.add(imageLabel, "center, width 40!, height 40!"); panel.add(nameLabel, "split 2, flowy"); panel.add(locationLabel); return panel; }
Example 5
Project: incubator-netbeans File: CollapsibleSectionPanel.java View Source Code | 5 votes |
public ActionsBuilder (JPanel panel, FocusListener listener) { this.focusListener = listener; panel.removeAll(); GroupLayout layout = (GroupLayout) panel.getLayout(); horizontalSeqGroup = layout.createSequentialGroup(); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(horizontalSeqGroup) ); verticalParallelGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(verticalParallelGroup) ); }
Example 6
Project: incubator-netbeans File: SectionPanel.java View Source Code | 5 votes |
public ActionsBuilder (JPanel panel) { panel.removeAll(); GroupLayout layout = (GroupLayout) panel.getLayout(); horizontalSeqGroup = layout.createSequentialGroup(); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(horizontalSeqGroup) ); verticalParallelGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(verticalParallelGroup) ); }
Example 7
Project: incubator-netbeans File: MenuEditLayer.java View Source Code | 5 votes |
private void rebuildOnScreenMenu(RADVisualContainer menuRAD) { if(menuRAD == null) return; if(hackedPopupFactory == null) return; JMenu menu = (JMenu) formDesigner.getComponent(menuRAD); if(hackedPopupFactory.containerMap.containsKey(menu)) { JPanel popupContainer = hackedPopupFactory.containerMap.get(menu); if(popupContainer == null) return; for(Component c : popupContainer.getComponents()) { if(c instanceof JMenu) { unconfigureMenu((JMenu)c); } else { unconfigureMenuItem((JComponent)c); } } popupContainer.removeAll(); // rebuild it for(RADVisualComponent child : menuRAD.getSubComponents()) { if(child != null) { JComponent jchild = (JComponent) formDesigner.getComponent(child); if(!isConfigured(jchild)) { if(jchild instanceof JMenu) { configureMenu(menu, (JMenu)jchild); } else { configureMenuItem(menu,jchild); } } popupContainer.add(jchild); } } // repack it popupContainer.setSize(popupContainer.getLayout().preferredLayoutSize(popupContainer)); validate(); popupContainer.repaint(); } }
Example 8
Project: incubator-netbeans File: MultiTabsPanel.java View Source Code | 5 votes |
@Override protected void initTabsPanel( JPanel panel ) { if( null == tabsPanel ) tabsPanel = new InnerTabsPanel( ( MultiTabsOptionsPanelController ) controller); panel.removeAll(); panel.setLayout( new BorderLayout() ); panel.add( tabsPanel, BorderLayout.CENTER ); }
Example 9
Project: EasyDragDrop File: MainFrame.java View Source Code | 5 votes |
private void DragFileHandle(final JPanel myPanel) { new FileDrop(myPanel, new FileDrop.Listener() { public void filesDropped(java.io.File[] files) { for (int i = 0; i < files.length; i++) { Icon ico = FileSystemView.getFileSystemView().getSystemIcon(files[i]); FindFiles(myPanel.getName(), files[i]); Image image = ((ImageIcon) ico).getImage(); ImageIcon icon = new ImageIcon(getScaledImage(image, 45, 45)); myPanel.removeAll(); myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS)); JLabel label = new JLabel(); label.setIcon(icon); label.setAlignmentX(CENTER_ALIGNMENT); myPanel.add(Box.createRigidArea(new Dimension(0, 60))); myPanel.add(label, BorderLayout.CENTER); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); JLabel labe2 = new JLabel(files[i].getName(), SwingConstants.CENTER); labe2.setBackground(new Color(240, 240, 240)); labe2.setForeground(new Color(0, 0, 0)); labe2.setFont(new Font("Segoe UI Light", Font.PLAIN, 14)); labe2.setAlignmentX(CENTER_ALIGNMENT); myPanel.add(labe2, BorderLayout.LINE_START); } } }); }
Example 10
Project: Equella File: Wizard.java View Source Code | 5 votes |
public void replacePage(JPanel parent, JPanel child) { parent.removeAll(); parent.add(child); parent.revalidate(); parent.repaint(); }
Example 11
Project: freecol File: BuildQueuePanel.java View Source Code | 5 votes |
/** * {@inheritDoc} */ @Override public Component getListCellRendererComponent(JList<? extends BuildableType> list, BuildableType value, int index, boolean isSelected, boolean cellHasFocus) { JPanel panel = (isSelected) ? selectedPanel : itemPanel; panel.removeAll(); ((ImageIcon)imageLabel.getIcon()).setImage(ImageLibrary.getBuildableImage(value, buildingDimension)); nameLabel.setText(Messages.getName(value)); panel.setToolTipText(lockReasons.get(value)); panel.add(imageLabel, "span 1 2"); if (lockReasons.get(value) == null) { panel.add(nameLabel, "wrap"); } else { panel.add(nameLabel, "split 2"); panel.add(lockLabel, "wrap"); } ImageLibrary lib = getImageLibrary(); List<AbstractGoods> required = value.getRequiredGoodsList(); int size = required.size(); for (int i = 0; i < size; i++) { AbstractGoods goods = required.get(i); ImageIcon icon = new ImageIcon(lib.getSmallIconImage(goods.getType())); JLabel goodsLabel = new JLabel(Integer.toString(goods.getAmount()), icon, SwingConstants.CENTER); if (i == 0 && size > 1) { panel.add(goodsLabel, "split " + size); } else { panel.add(goodsLabel); } } return panel; }
Example 12
Project: freecol File: FreeColFileChooserUI.java View Source Code | 5 votes |
@Override protected void addControlButtons() { JPanel buttonPanel = getButtonPanel(); Component[] buttons = buttonPanel.getComponents(); buttonPanel.removeAll(); for (int i=buttons.length-1; i>=0; i--) { buttonPanel.add(buttons[i]); } super.addControlButtons(); }
Example 13
Project: FreeCol File: BuildQueuePanel.java View Source Code | 5 votes |
/** * {@inheritDoc} */ @Override public Component getListCellRendererComponent(JList<? extends BuildableType> list, BuildableType value, int index, boolean isSelected, boolean cellHasFocus) { JPanel panel = (isSelected) ? selectedPanel : itemPanel; panel.removeAll(); ((ImageIcon)imageLabel.getIcon()).setImage(ImageLibrary.getBuildableImage(value, buildingDimension)); nameLabel.setText(Messages.getName(value)); panel.setToolTipText(lockReasons.get(value)); panel.add(imageLabel, "span 1 2"); if (lockReasons.get(value) == null) { panel.add(nameLabel, "wrap"); } else { panel.add(nameLabel, "split 2"); panel.add(lockLabel, "wrap"); } ImageLibrary lib = getImageLibrary(); List<AbstractGoods> required = value.getRequiredGoodsList(); int size = required.size(); for (int i = 0; i < size; i++) { AbstractGoods goods = required.get(i); ImageIcon icon = new ImageIcon(lib.getSmallIconImage(goods.getType())); JLabel goodsLabel = new JLabel(Integer.toString(goods.getAmount()), icon, SwingConstants.CENTER); if (i == 0 && size > 1) { panel.add(goodsLabel, "split " + size); } else { panel.add(goodsLabel); } } return panel; }
Example 14
Project: FreeCol File: FreeColFileChooserUI.java View Source Code | 5 votes |
@Override protected void addControlButtons() { JPanel buttonPanel = getButtonPanel(); Component[] buttons = buttonPanel.getComponents(); buttonPanel.removeAll(); for (int i=buttons.length-1; i>=0; i--) { buttonPanel.add(buttons[i]); } super.addControlButtons(); }
Example 15
Project: incubator-netbeans File: VCSCommitPanel.java View Source Code | 4 votes |
protected void stopProgress() { JPanel p = getProgressPanel(); p.removeAll(); p.setVisible(false); }
Example 16
Project: sbc-qsystem File: FAdvanceCalendar.java View Source Code | 4 votes |
private void printDayWeek(JPanel panel, GridAndParams res, int weekDay) { final GregorianCalendar gc = new GregorianCalendar(); panel.removeAll(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); for (Date dd : res.getTimes()) { gc.setTime(dd); int ii = gc.get(GregorianCalendar.DAY_OF_WEEK) - 1; if (ii < 1) { ii = 7; } gc.setTime(this.firstWeekDay); gc.add(GregorianCalendar.DAY_OF_WEEK, ii - 1); final GregorianCalendar gc_client = new GregorianCalendar(); final GregorianCalendar gc_now = new GregorianCalendar(); gc_client.setTime(dd); gc_now.setTime(new Date()); // проверим не отлистал ли пользователь слишком далеко, куда уже нельзя boolean f = true; int per = 0; if (gc_client.get(GregorianCalendar.DAY_OF_YEAR) - gc_now .get(GregorianCalendar.DAY_OF_YEAR) > 0) { per = gc_client.get(GregorianCalendar.DAY_OF_YEAR) - gc_now .get(GregorianCalendar.DAY_OF_YEAR); } else { per = gc_client.get(GregorianCalendar.DAY_OF_YEAR) + ( gc_now.isLeapYear(gc_now.get(GregorianCalendar.YEAR)) ? 365 : 366 - gc_now.get(GregorianCalendar.DAY_OF_YEAR)); } if (per > res.getAdvanceLimitPeriod() && res.getAdvanceLimitPeriod() != 0) { f = false; } if (ii == weekDay && f && gc.getTime().after(gc_now.getTime())) { panel.add(new QAvancePanel(new IAdviceEvent() { @Override public void eventPerformed(Date date) { if (clockBack.isActive()) { clockBack.stop(); } // ставим предварительного кастомера result = NetCommander .standInServiceAdvance(netProperty, service.getId(), date, advancedCustomer, inputData, comments); // закрываем диалог выбора предварительного выбора времени setVisible(false); } }, dd, true)); } } if (panel.getComponentCount() == 0) { panel.setLayout(new GridLayout(1, 1)); panel.add(new JLabel(new ImageIcon( Uses.loadImage(this, "/ru/apertum/qsystem/client/forms/resources/noActive.png", null)), JLabel.CENTER)); } }
Example 17
Project: rapidminer File: OpenProcessCard.java View Source Code | 4 votes |
private JPanel createRecoverButtonPanel(final AutoSave autosave) { final JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(WARNING_BACKGROUND_COLOR); final JLabel recoverLabel = new JLabel(I18N.getGUILabel("getting_started.label.recover", new Object[0])); recoverLabel.setIcon(SwingTools.createIcon("16/loading.gif")); recoverLabel.setFont(GettingStartedDialog.OPEN_SANS_SEMIBOLD_14); recoverLabel.setForeground(WARNING_TEXT_COLOR); recoverLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0)); String autosavedPath = autosave.getAutosavedPath(); JButton recoverButton = new JButton(new ResourceAction("getting_started.recover", new Object[]{autosavedPath == null?"autosaved process":autosavedPath}) { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { if(OpenProcessCard.this.entryList != null) { OpenProcessCard.this.entryList.setFocusable(false); } buttonPanel.removeAll(); buttonPanel.add(recoverLabel); buttonPanel.revalidate(); (new ProgressThread("recover_process") { public void run() { autosave.recoverAutosavedProcess(); SwingTools.invokeLater(new Runnable() { public void run() { if(OpenProcessCard.this.entryList != null) { OpenProcessCard.this.entryList.setFocusable(true); } OpenProcessCard.this.owner.dispose(); } }); } }).start(); } }); this.styleButton(recoverButton); buttonPanel.add(recoverButton); this.owner.getRootPane().setDefaultButton(recoverButton); return buttonPanel; }
Example 18
Project: Hotel-Properties-Management-System File: Main_UpperToolbar.java View Source Code | 4 votes |
public ActionListener UpperToolbarActionListener(final JPanel mainPanel) { ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == roomsBtn) { theRooms = new Main_AllRooms(); infoColorTable = new ColorInfoTable(); // Set the usage of room into info table infoColorTable.setCleanLabelCount(theRooms.cleanCounter); infoColorTable.setDirtyLabelCount(theRooms.dirtyCounter); infoColorTable.setDndLabelCount(theRooms.dndCounter); mainPanel.removeAll(); mainPanel.add(theRooms.getWindow(), BorderLayout.WEST); mainPanel.add(infoColorTable, BorderLayout.EAST); mainPanel.revalidate(); mainPanel.repaint(); } else if (e.getSource() == guestsBtn) { customersFrame = new Main_CustomersFrame(); mainPanel.removeAll(); mainPanel.add(customersFrame, BorderLayout.CENTER); mainPanel.revalidate(); mainPanel.repaint(); } else if (e.getSource() == rezervationBtn) { rezervFrame = new Main_Reservations(); mainPanel.removeAll(); rezervFrame.populateMainTable(); mainPanel.add(rezervFrame, BorderLayout.CENTER); mainPanel.revalidate(); mainPanel.repaint(); } else if (e.getSource() == blockadeBtn) { blockadeFrame = new Main_Blockade(); mainPanel.removeAll(); mainPanel.add(blockadeFrame, BorderLayout.CENTER); mainPanel.revalidate(); mainPanel.repaint(); } else if (e.getSource() == roomCleaningBtn) { cleaningFrame = new Main_RoomCleaning(); mainPanel.removeAll(); mainPanel.add(cleaningFrame, BorderLayout.CENTER); mainPanel.revalidate(); mainPanel.repaint(); } else if (e.getSource() == cashBtn) { cashdesk = new Main_CashDesk(); mainPanel.removeAll(); mainPanel.add(cashdesk, BorderLayout.CENTER); mainPanel.revalidate(); mainPanel.repaint(); } else if (e.getSource() == auditBtn) { audit = new Main_Audit(); audit.initializeAuditPane(); mainPanel.removeAll(); mainPanel.add(audit, BorderLayout.CENTER); mainPanel.revalidate(); mainPanel.repaint(); } else if (e.getSource() == refreshBtn) { mainPanel.removeAll(); mainPanel.revalidate(); mainPanel.repaint(); } } }; return actionListener; }
Example 19
Project: sbc-qsystem File: FWelcome.java View Source Code | 4 votes |
public void clearPanel(JPanel panel) { panel.removeAll(); panel.repaint(); }
Example 20
Project: Equella File: InternalDataSourceTab.java View Source Code | 4 votes |
private void attemptToShowFullUi() { if( tree != null ) { return; } GlassSwingWorker<?> worker = new GlassSwingWorker<Boolean>() { private Map<String, Pair<String, String>> predefinedTermDataKeys; @Override public Boolean construct() throws Exception { boolean valid = taxonomy != null && clientService.getService(RemoteTaxonomyService.class).identifyByUuid(taxonomy.getUuid()) != 0; if( valid ) { predefinedTermDataKeys = new HashMap<String, Pair<String, String>>(); for( Extension ext : pluginService.getConnectedExtensions("com.tle.admin.taxonomy.tool", "predefinedTermDataKey") ) { final String key = ext.getParameter("key").valueAsString(); final String name = CurrentLocale.get(ext.getParameter("name").valueAsString()); final String desc = CurrentLocale.get(ext.getParameter("description").valueAsString()); predefinedTermDataKeys.put(key, new Pair<String, String>(name, desc)); } } return valid; } @Override public void finished() { if( !get() ) { return; } final JPanel p = InternalDataSourceTab.this; // Remove this listener and clear the panel p.removeComponentListener(ensureTaxonomySavedListener); p.removeAll(); final RemoteTermService termService = clientService.getService(RemoteTermService.class); tree = new AbstractTreeEditor<TermTreeNode>() { @Override protected AbstractTreeEditorTree<TermTreeNode> createTree() { return new TermTree(taxonomy, true, termService); } @Override protected AbstractTreeNodeEditor createEditor(TermTreeNode node) { return new TermEditor(termService, predefinedTermDataKeys, taxonomy, node); } }; p.setLayout(new MigLayout("wrap 1, fill")); p.add(new JLabel("<html>" + s("immediatechanges"))); p.add(tree, "push, grow"); p.revalidate(); p.repaint(); } }; worker.setComponent(InternalDataSourceTab.this); worker.start(); }