public void setTopRightPanelDeprecated(File f) { try { if (f.isDirectory()) { // Do nothing, leave it as it is } else if (f.getName().equalsIgnoreCase("General Settings.xml")) { // JGeneralSetupPanel jgsp = new JGeneralSetupPanel(f); // rightTopPanel.add(jgsp); // System.exit(-1); // this.remove(rightTopPanel); // this.rightTopPanel = jgsp; // this.add(rightTopPanel); rightTopPanel.validate(); rightTopPanel.repaint(); } else if (f.getName().endsWith("xml")) { // JParameterSetupPanel jpsp = new JParameterSetupPanel(f); this.remove(rightTopPanel); // this.rightTopPanel = jpsp; this.add(rightTopPanel); rightTopPanel.validate(); rightTopPanel.repaint(); } } catch (Exception e) { System.out.println("Some error processing " + f.getName()); } }
private void browseItem(DiscoverItems.Item discoveredItem) { addAddress(discoveredItem.getEntityID()); browsePanel.removeAll(); ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con); DiscoverItems result; try { result = discoManager.discoverItems(discoveredItem.getEntityID()); } catch (XMPPException e) { browsePanel.invalidate(); browsePanel.validate(); browsePanel.repaint(); return; } Iterator<DiscoverItems.Item> discoverItems = result.getItems(); List<Entity> list = new ArrayList<Entity>(); while (discoverItems.hasNext()) { DiscoverItems.Item item = discoverItems.next(); Entity entity = new Entity(item); browsePanel.add(entity); list.add(entity); } GraphicUtils.makeSameSize((JComponent[]) list.toArray(new JComponent[list.size()])); browsePanel.invalidate(); browsePanel.validate(); browsePanel.repaint(); }
private void updateMacroListEditor(boolean isStructure) { if (mIsStructure != isStructure) { mIsStructure = isStructure; if (isStructure) { String[] idcodeList = mTextArea.getText().split("\\n"); if (mStructurePane == null) { DefaultCompoundCollectionModel.IDCode collectionModel = new DefaultCompoundCollectionModel.IDCode(); mStructurePane = new CompoundCollectionPane<String>(collectionModel, true); mStructurePane.setSelectable(true); mStructurePane.setEditable(true); mStructurePane.setClipboardHandler(new ClipboardHandler()); mStructurePane.setShowValidationError(true); mStructurePane.setStructureSize(80); mStructurePane.setPreferredSize( new Dimension(240, Math.max(240, Math.min(640, 80 * idcodeList.length)))); mStructurePane.setEnabled(mRadioButton.isSelected() && !mRadioButtonSort.isSelected()); } mStructurePane.getModel().clear(); StereoMolecule mol = new StereoMolecule(); for (String idcode : idcodeList) { try { idcode = idcode.trim(); if (idcode.length() != 0) { new IDCodeParser().parse(mol, idcode); // test validity of idcode mStructurePane.getModel().addCompound(idcode); } } catch (Exception e) { } } mDialogPanel.remove(mScrollPane); mDialogPanel.add(mStructurePane, "1,7,3,7"); mDialogPanel.validate(); getDialog().pack(); } else { StringBuilder sb = new StringBuilder(); for (int i = 0; i < mStructurePane.getModel().getSize(); i++) { sb.append(mStructurePane.getModel().getCompound(i)); sb.append('\n'); } mTextArea.setText(sb.toString()); mDialogPanel.remove(mStructurePane); mDialogPanel.add(mScrollPane, "1,7,3,7"); mDialogPanel.validate(); getDialog().pack(); mScrollPane.repaint(); } } }
public void setFolderViewed(String folderViewed, String notesFile) { this.folderViewed = folderViewed; this.notesFile = notesFile; if (folderViewed == null || notesFile == null) { JLabel noLabel = new JLabel("No notes available at this level"); notespane.setLayout(new BoxLayout(notespane, BoxLayout.PAGE_AXIS)); notespane.removeAll(); notespane.add(Box.createVerticalGlue()); notespane.add(noLabel); notespane.add(Box.createVerticalGlue()); } else { File folder = new File(this.folderViewed); File notes = new File(this.notesFile); notesLabel.setText(notes.getAbsolutePath()); notespane.setLayout(new BorderLayout()); notespane.removeAll(); notespane.add(editor); if (notes.exists()) editor.open(notes); fileRepository.setFolder(folder); } notespane.invalidate(); notespane.validate(); this.repaint(); }
/** Add a JEditorPane to the bottom on the dialog. */ private void addMessagePanel() { htmlPanel = new JPanel(); htmlPane = new JEditorPane("text/html", ""); htmlPane.setEditable(false); htmlPane.validate(); htmlPanel.setLayout(new GridLayout(1, 1)); htmlPanel.setPreferredSize(new Dimension(100, 100)); htmlPanel.add(new JScrollPane(htmlPane), BorderLayout.CENTER); htmlPanel.validate(); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 1; c.gridwidth = 3; c.weightx = 1.0; c.weighty = 1.0; c.anchor = GridBagConstraints.SOUTH; startTime = new Date().getTime(); lastReportTime = startTime; timer.activity.getViewPanel(false).add(htmlPanel, c); }
public void drawPanel() { try { // System.out.println("right before the while loop of the thread"); // layeredPane.add(background,99); panel.remove(layeredPane); Iterator<PlayerMob> allPlayers = players.iterator(); PlayerMob aPlayer = null; /*while(allPlayers.hasNext()){ aPlayer = (PlayerMob) allPlayers.next(); //System.out.println("INTHELOOP:info.getUsername ="******" myChat.getUsername ="******"for loop index catch"); continue; }*/ } catch (NullPointerException ed) { System.err.println("for loop null catch"); // startDrawingPanelThread(); } catch (Exception ev) { System.err.println("for loop catch"); ev.printStackTrace(); } }
private void addResult(String inputFileName, String outputModelName, String tempFileName) { TrafficModelingResult result = new TrafficModelingResult(inputFileName, outputModelName, tempFileName); panResults.add(result); panResults.setPreferredSize(new Dimension(1280, panResults.getComponentCount() * (30 + 5))); panResults.validate(); }
/** * The constructor that will add the items to this panel. * * @param freeColClient The <code>FreeColClient</code> for the game. * @param gui The <code>GUI</code> to display on. * @param possibleFoundingFathers The founding fathers which can be selected. The length of the * array is the same as the number of <code>FoundingFather</code> categories and the values * identifies a <code>FoundingFather</code> to be picked in each of those categories. */ public ChooseFoundingFatherDialog( FreeColClient freeColClient, GUI gui, List<FoundingFather> possibleFoundingFathers) { super(freeColClient, gui); this.possibleFathers = possibleFoundingFathers; setLayout(new MigLayout("wrap 1", "align center")); setFocusCycleRoot(false); tb = new JTabbedPane(JTabbedPane.TOP); FatherDetailPanel details = new FatherDetailPanel(getFreeColClient(), gui, new ColopediaPanel(getFreeColClient(), gui)); for (int index = 0; index < possibleFoundingFathers.size(); index++) { FoundingFather father = possibleFoundingFathers.get(index); JPanel panel = new JPanel(); details.buildDetail(father, panel); panel.validate(); tb.addTab(Messages.message(father.getTypeKey()), panel); } tb.setSelectedIndex(0); JButton helpButton = new JButton( getFreeColClient().getActionManager().getFreeColAction("colopediaAction.FATHERS")); helpButton.setText(Messages.message("help")); add(getDefaultHeader(Messages.message("foundingFatherDialog.nominate"))); add(tb, "width 100%"); add(okButton, "newline 20, split 2, tag ok"); add(helpButton, "tag help"); setSize(tb.getPreferredSize()); }
public void updateLastCustomer() { if (currentCustomer != null) { customerStateCheckBox.setSelected(currentCustomer.getGui().isHungry()); customerStateCheckBox.setEnabled(!currentCustomer.getGui().isHungry()); customerInformationPanel.validate(); } }
private void resetSemImEditor() { java.util.List<SemEstimator> semEstimators = wrapper.getMultipleResultList(); if (semEstimators.size() == 1) { SemEstimator estimatedSem = semEstimators.get(0); SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem())); panel.removeAll(); panel.add(editor, BorderLayout.CENTER); panel.revalidate(); panel.repaint(); } else { JTabbedPane tabs = new JTabbedPane(); for (int i = 0; i < semEstimators.size(); i++) { SemEstimator estimatedSem = semEstimators.get(i); SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem())); JPanel _panel = new JPanel(); _panel.setLayout(new BorderLayout()); _panel.add(editor, BorderLayout.CENTER); tabs.addTab(estimatedSem.getDataSet().getName(), _panel); } panel.removeAll(); panel.add(tabs); panel.validate(); } }
private void clearDeleteRecord() { if (deleteList != null) { java.util.List list = deleteList.getSelection(); if (list.size() > 0) { try { java.util.List dbIDs = new ArrayList(list.size()); for (Iterator it = list.iterator(); it.hasNext(); ) { GKInstance instance = (GKInstance) it.next(); dbIDs.add(instance.getDBID()); } fileAdaptor.clearDeleteRecord(dbIDs); } catch (IOException e) { System.err.println("SynchronizationDialog.clearDeleteRecord(): " + e); e.printStackTrace(); } deleteList.deleteInstances(list); // Check if deleteList needs to be removed if (deleteList.getDisplayedInstances().size() == 0) { centerPane.remove(deleteList); centerPane.validate(); centerPane.repaint(); } } } }
/** * Adds the componentType buttons to the Panel of Main Window. * * @param pkg_name whose componentType buttons will be added * @param a needed for the addition of the ActionListener of respective buttons and calling method * of Pad_Draw */ public void add_componentType_buttons(package_cls pkg_name, final counts a) { int i; JLabel pkg_hdng = new JLabel(pkg_name.getName()); panel.add(pkg_hdng); for (i = 0; i < pkg_name.getComponentType_list().size(); i++) { final componentType cmp_Types = pkg_name.getComponentType_list().get(i); int btnHeight, btnWidth; double scale = 0.5; btnWidth = (int) (scale * (double) cmp_Types.getWidth()); btnHeight = (int) (scale * (double) cmp_Types.getHeight()); ImageIcon myIcon = new ImageIcon(cmp_Types.getType_Img()); BufferedImage bi = new BufferedImage(btnWidth, btnHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g = bi.createGraphics(); g.scale(scale, scale); myIcon.paintIcon(null, g, 0, 0); g.dispose(); JButton strctButton = new JButton(new ImageIcon(bi)); strctButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { drawPad.add_componentType(cmp_Types, a); taskbar.setText("Click to add a component"); } }); panel.add(strctButton); } panel.validate(); // Updates the Panel }
protected void displayMessage(String message) { cleanMessage(); messagePanel.add(new JLabel(message)); messagePanel.setVisible(true); messagePanel.validate(); messagePanel.repaint(); }
/** * This function takes the given customer or waiter object and changes the information panel to * hold that person's info. * * @param person customer or waiter object */ public void updateInfoPanel(Object person) { stateCB.setVisible(true); changeOrder.setVisible(false); currentPerson = person; if (person instanceof CustomerAgent) { CustomerAgent customer = (CustomerAgent) person; stateCB.setText("Hungry?"); changeOrder.setVisible(true); // changeOrder.setText("Change Order?"); // changeOrder.setSelected(customer.waiter.requestingChange(customer)); // changeOrder.setEnabled(!customer.waiter.requestingChange(customer)); stateCB.setSelected(customer.isHungry()); stateCB.setEnabled(!customer.isHungry()); infoLabel.setText("<html><pre> Name: " + customer.getName() + " </pre></html>"); } else if (person instanceof WaiterAgent) { WaiterAgent waiter = (WaiterAgent) person; // stateCB.setText("On Break?"); // stateCB.setSelected(waiter.isOnBreak()); // stateCB.setEnabled(true); requestBreak.setVisible(true); stateCB.setVisible(false); changeOrder.setVisible(false); infoLabel.setText("<html><pre> Name: " + waiter.getName() + " </html>"); } infoPanel.validate(); }
private void browse(String serviceName) { browsePanel.removeAll(); ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(con); DiscoverItems result; try { result = discoManager.discoverItems(serviceName); } catch (XMPPException e) { Log.error(e); return; } addAddress(serviceName); Iterator<DiscoverItems.Item> discoverItems = result.getItems(); while (discoverItems.hasNext()) { DiscoverItems.Item item = discoverItems.next(); Entity entity = new Entity(item); browsePanel.add(entity); } browsePanel.invalidate(); browsePanel.validate(); browsePanel.repaint(); }
public void addComment(Comment comment) { CommentView commentView = createCommentView(comment); commentsPanel.add(commentView); commentsPanel.validate(); updateNumberLabel(); }
private void swapContainers(Container newContainer) { if (newContainer != null) { swappableContainer.removeAll(); swappableContainer.add(newContainer); swappableContainer.repaint(); swappableContainer.validate(); } }
private void removeInstanceList(InstanceListPane listPane) { SectionTitlePane titlePane = (SectionTitlePane) listToTitle.get(listPane); centerPane.remove(titlePane); centerPane.remove(listPane); centerPane.validate(); centerPane.repaint(); listToTitle.remove(listPane); }
/** * Remove the currently display gui and insert the given one. * * @param comp The new gui. */ private void addToContents(JComponent comp) { handlerHolder.removeAll(); comp.setPreferredSize(new Dimension(200, 300)); handlerHolder.add(comp, BorderLayout.CENTER); if (myContents != null) { myContents.invalidate(); myContents.validate(); myContents.repaint(); } }
private void createLoggedInButton(PanelQuery queryPanel) { try { JPanel toolsPanel = queryPanel.getToolBar().getToolsPanelCenter(); toolsPanel.add(getNurAngemeldeteCheckbox()); toolsPanel.validate(); } catch (Exception e) { } }
/** * Remove the currently display gui and insert the given one. * * @param comp The new gui. */ private void addToContents(JComponent comp) { treePanel.removeAll(); comp.setPreferredSize(new Dimension(200, 300)); treePanel.add(comp, BorderLayout.CENTER); if (contents != null) { contents.invalidate(); contents.validate(); contents.repaint(); } }
/** * updateCustomerInformationPanel() takes the given customer (or, for v3, Host) object and changes * the information panel to hold that person's info. * * @param temp customer (or waiter) object */ public void updateCustomerInformationPanel(Customer temp) { customerStateCheckBox.setVisible(true); currentCustomer = temp; Customer customer = temp; customerStateCheckBox.setText("Hungry?"); customerStateCheckBox.setSelected(customer.getGui().isHungry()); customerStateCheckBox.setEnabled(!customer.getGui().isHungry()); infoCustomerLabel.setText("<html><pre> Name: " + customer.getName() + " </pre></html>"); customerInformationPanel.validate(); }
/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user pressed the remove button if (e.getSource() == remove_button) { int row = table.getSelectedRow(); model.removeRow(row); table.clearSelection(); table.repaint(); valueChanged(null); } // Check if the user pressed the remove all button if (e.getSource() == remove_all_button) { model.clearAll(); table.setRowSelectionInterval(0, 0); table.repaint(); valueChanged(null); } // Check if the user pressed the filter button if (e.getSource() == filter_button) { filter.showDialog(); if (filter.okPressed()) { // Update the display with new filter model.setFilter(filter); table.repaint(); } } // Check if the user pressed the start button if (e.getSource() == start_button) { start(); } // Check if the user pressed the stop button if (e.getSource() == stop_button) { stop(); } // Check if the user wants to switch layout if (e.getSource() == layout_button) { details_panel.remove(details_soap); details_soap.removeAll(); if (details_soap.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { details_soap = new JSplitPane(JSplitPane.VERTICAL_SPLIT); } else { details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); } details_soap.setTopComponent(request_panel); details_soap.setRightComponent(response_panel); details_soap.setResizeWeight(.5); details_panel.add(details_soap, BorderLayout.CENTER); details_panel.validate(); details_panel.repaint(); } // Check if the user is changing the reflow option if (e.getSource() == reflow_xml) { request_text.setReflowXML(reflow_xml.isSelected()); response_text.setReflowXML(reflow_xml.isSelected()); } }
public void incMiddleLayers(List<Integer> middleNeurons) { int sz = middleNeurons.size(); JTextField txtf = new JTextField(middleNeurons.get(sz - 1).toString()); _txtMiddleLayers.add(txtf); _validators.add(new TextFieldNumberValidator(txtf, "Wrong middle neurons numbers!")); _middleLayers.add(txtf); _middleLayers.validate(); _middleLayers.repaint(); }
/** * Rimuove una JCheckBox dal tab delle commonalities candidates * * @param s stringa contenente il nome da rimuovere */ private void removeCheckBox(String s) { if (s == null) return; for (int i = 0; i < checkBoxCommonalities.size(); i++) { if (s.equals(checkBoxCommonalities.get(i).getText())) { panelCommonalities.remove(checkBoxCommonalities.get(i)); checkBoxCommonalities.remove(i); panelCommonalities.validate(); } } }
private void updateRozkladScrollPane() { mainPanel.remove(rozkladScrollPane); setRozkladScrollPane(); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 2; c.gridy = 0; c.gridheight = 2; mainPanel.add(rozkladScrollPane, c); mainPanel.validate(); }
public void decMiddleLayers(List<Integer> middleNeurons) { int sz = middleNeurons.size(); JTextField txtf = _txtMiddleLayers.get(sz); _txtMiddleLayers.remove(sz); _validators.remove(sz); _middleLayers.remove(txtf); _middleLayers.validate(); _middleLayers.repaint(); }
void updateList() { if (runned) { empty.removeAll(); list = new CheckBoxList(field.getClusters(), field.getNoise(), this); JScrollPane sp = new JScrollPane(); sp.getViewport().add(list); empty.add(sp); sp.repaint(); empty.validate(); } }
void checkRunned() { if (runned) { list.selectAll(); // Add all clusters to Field again contentpanel.resetColors(); // Reset the colors PointCategory.resetIndex(); // Reset the point index field.reset(); // Reset the field updateContentPanel(); empty.removeAll(); empty.validate(); runned = false; } }
/** * Invoked when an item has been selected or deselected by the user. * * <p>Invoked when an item has been selected or deselected by the user. The code written for this * method performs the operations that need to occur when an item is selected (or deselected). */ public void itemStateChanged(ItemEvent e) { /* format menu */ if (e.getSource() == wordWrap) { editor.setLineWrap(!editor.getLineWrap()); side.setLineWrap(editor.getLineWrap()); // wordWrap.setText(editor.getLineWrap() ? "Disable Word Wrap" : "Enable Word Wrap"); wordWrap.setDisplayedMnemonicIndex(wordWrap.getText().indexOf('W')); } /* view menu */ if (e.getSource() == toggleSide) { // hide the sidePane, sideButton, and update the text in the toggleSide JMenuItem (need to // update mnemonicindex as well) sidePane.setVisible(!sidePane.isVisible()); sideButton.setVisible(sidePane.isVisible()); // toggleSide.setText(sidePane.isVisible() ? "Hide Side Pane" : "Show Side Pane"); toggleSide.setDisplayedMnemonicIndex(5); // easier to remove everything and then add them back centerPanel.removeAll(); centerPanel.add(editorPane); if (sideButton.isVisible()) { centerPanel.add(sidePane); } centerPanel.validate(); } }