void g(double ntime) { double dt = ntime - time; time = ntime; for (Box b : bs) { b.go(dt); } }
public static void ocuparVaga(Carro carro, int hora, int minuto) { Box box = getVagaLivre(); if (box != null) { box.setCarro(carro); box.setHorarioEntrada(hora, minuto); } }
/** @return A Box for selecting an asset type, the old asset and its replacement asset. */ private Box assetChoiceBox() { TreeSet<String> types = new TreeSet<String>(); types.add(AssetType.CHARACTER.toString()); types.add(AssetType.PROP.toString()); types.add(AssetType.SET.toString()); // JDrawer toReturn; Box hbox = new Box(BoxLayout.X_AXIS); { JCollectionField assetType = UIFactory.createCollectionField(types, diag, sTSize); assetType.setActionCommand("type"); assetType.addActionListener(this); JCollectionField oldAsset = UIFactory.createCollectionField(charList.keySet(), diag, sVSize); JCollectionField newAsset = UIFactory.createCollectionField(charList.keySet(), diag, sVSize); hbox.add(assetType); hbox.add(Box.createHorizontalStrut(10)); hbox.add(oldAsset); hbox.add(Box.createHorizontalStrut(5)); hbox.add(newAsset); // pPotentials.put(oldAsset, newAsset); } list.add(Box.createVerticalStrut(5)); return hbox; // toReturn; } // return assetChoiceBox
public void setEntity(java.lang.Object ent) { Method[] methods = ent.getClass().getDeclaredMethods(); box.removeAll(); for (Method m : methods) { if (m.getName().toLowerCase().startsWith("get")) { String attName = m.getName().substring(3); Object result; try { result = m.invoke(ent, new Object[] {}); String value = "null"; if (result != null) value = result.toString(); JPanel attPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); attPane.add(new JLabel(attName + " : " + m.getReturnType().getName() + " = " + value)); box.add(attPane); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
private void buildExternalsPanel() { FormBuilder builder = FormBuilder.create().layout(new FormLayout("fill:pref:grow", "p")); int row = 1; for (ExternalFileEntry efe : externals) { builder.add(efe.getPanel()).xy(1, row); builder.appendRows("2dlu, p"); row += 2; } builder.add(Box.createVerticalGlue()).xy(1, row); builder.appendRows("2dlu, p, 2dlu, p"); builder.add(addExtPan).xy(1, row + 2); builder.add(Box.createVerticalGlue()).xy(1, row + 2); // builder.getPanel().setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.green)); // externalFilesPanel.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red)); JScrollPane pane = new JScrollPane(builder.getPanel()); pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); externalFilesPanel.setMinimumSize(new Dimension(400, 400)); externalFilesPanel.setPreferredSize(new Dimension(400, 400)); externalFilesPanel.removeAll(); externalFilesPanel.add(pane, BorderLayout.CENTER); externalFilesPanel.revalidate(); externalFilesPanel.repaint(); }
public DisplayUserDirectory() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; hmlabel.setForeground(Color.black); add(hmlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(hmdir, gbc); add(Box.createVerticalStrut(15), gbc); gbc.gridwidth = 1; vjlabel.setForeground(Color.black); add(vjlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(vjdir, gbc); add(Box.createVerticalStrut(0), gbc); gbc.gridwidth = 1; vjlabel2.setForeground(Color.black); add(vjlabel2, gbc); setBorder( new CompoundBorder( // i18n // BorderFactory.createTitledBorder(" User_Directories "), BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
public AboutDialog(View view) { super(view, jEdit.getProperty("about.title"), true); JPanel content = new JPanel(new BorderLayout()); content.setBorder(new EmptyBorder(12, 12, 12, 12)); setContentPane(content); content.add(BorderLayout.CENTER, new AboutPanel()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonPanel.add(Box.createGlue()); close = new JButton(jEdit.getProperty("common.close")); close.addActionListener(new ActionHandler()); getRootPane().setDefaultButton(close); buttonPanel.add(close); buttonPanel.add(Box.createGlue()); content.add(BorderLayout.SOUTH, buttonPanel); pack(); setResizable(false); setLocationRelativeTo(view); show(); }
public HeaderPanel(String heading) { super(); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.setBackground(background); JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT); Font labelFont = new Font("Dialog", Font.BOLD, 18); panelLabel.setFont(labelFont); this.add(panelLabel); this.add(Box.createHorizontalGlue()); refresh = new JButton("Refresh"); refresh.addActionListener(this); this.add(refresh); this.add(Box.createHorizontalStrut(5)); root = new JComboBox(); Dimension d = root.getPreferredSize(); d.width = 90; root.setPreferredSize(d); root.setMaximumSize(d); File[] roots = directoryPane.getRoots(); for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath()); this.add(root); root.setSelectedIndex(directoryPane.getCurrentRootIndex()); root.addActionListener(this); this.add(Box.createHorizontalStrut(17)); }
public Flexible copyToGroup(String group) { String newName; if (group.equals(nullString)) newName = Group.substractObjectName(getName()); else newName = group + Constants.GROUP_SEPARATOR + Group.substractObjectName(getName()); // object with new name already exists, add suffix ///!!! while (Group.getRoot().findObject(newName, true) != null) newName = StringUtils.incrementName(newName, Constants.COPY_SUFFIX); Box grBox = new Box( newName, null, startVertex.getX(), startVertex.getY(), endVertex.getX(), endVertex.getY()); grBox.setColor(getColor()); Group.getRoot().addSubObject(newName, grBox, true); // ViewState view = ViewState.getInstance(); // grBox.move(20 - view.getRx(), 20 - view.getRy()); unconditionalValidation(); return grBox; }
@Override protected void layoutComponents() { batchPanel = new JPanel(); batchPanel.setLayout(new GridBagLayout()); GridBagConstraintsExt c = new GridBagConstraintsExt(); c.ipadx = 2; c.ipady = 2; c.insets = new Insets(5, 5, 5, 5); c.place(0, 1, 1, 1); batchPanel.add(entryDateLabel, c); c.place(1, 1, 2, 1); batchPanel.add(entryDateSpinner, c); c.place(3, 1, 1, 1); batchPanel.add(countLabel, c); c.place(4, 1, 1, 1); batchPanel.add(countField, c); c.place(0, 0, 1, 1); batchPanel.add(barcodeLabel, c); c.place(1, 0, 2, 1); batchPanel.add(barcodeField, c); c.place(3, 0, 2, 1); batchPanel.add(scannerBox, c); c.place(1, 2, 1, 1); batchPanel.add(itemActionButton, c); c.place(2, 2, 1, 1); batchPanel.add(undoButton, c); c.place(3, 2, 1, 1); batchPanel.add(redoButton, c); c.place(4, 2, 1, 1); batchPanel.add(doneButton, c); setMaximumSize(batchPanel); productPanel = new JPanel(); productPanel.setLayout(new BoxLayout(productPanel, BoxLayout.Y_AXIS)); productPanel.add(Box.createRigidArea(new Dimension(10, 10))); productPanel.add(batchPanel); productPanel.add(Box.createRigidArea(new Dimension(10, 10))); productPanel.add(productTableScrollPane); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, productPanel, itemTableScrollPane); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.add(splitPane); }
public void buildPopulationBox() { rebuilding = true; populationBox.removeAll(); peopleList = new ArrayList<Object>(); famList = new ArrayList<Family>(); peopleList.addAll(ctxt.individualCensus); String plur = (peopleList.size() == 1 ? "" : "s"); populationBox.setLayout(new BoxLayout(populationBox, BoxLayout.PAGE_AXIS)); populationBox.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "Current Population")); populationBox.setAlignmentX(0.5f); populationBox.add(Box.createRigidArea(new Dimension(8, 0))); indivLabel = new JLabel("Contains " + peopleList.size() + " Individual" + plur); indivLabel.setAlignmentX(0.5f); populationBox.add(indivLabel); if (peopleList.size() > 0) { JPanel indivBtnBox = new JPanel(); indivBtnBox.setLayout(new BoxLayout(indivBtnBox, BoxLayout.LINE_AXIS)); Dimension sizer2 = new Dimension(350, 50); String[] indMenu = genIndMenu(peopleList); indPick = new JComboBox(indMenu); indPick.addActionListener(listener); indPick.setActionCommand("view/edit person"); indPick.setMinimumSize(sizer2); indPick.setMaximumSize(sizer2); indPick.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "View/Edit Person")); indivBtnBox.add(indPick); populationBox.add(indivBtnBox); } // end of if-any-people-exist famList.addAll(ctxt.familyCensus); // end of filtering deleted records plur = (famList.size() == 1 ? "y" : "ies"); famLabel = new JLabel("Contains " + famList.size() + " Famil" + plur); famLabel.setAlignmentX(0.5f); populationBox.add(Box.createRigidArea(new Dimension(0, 4))); populationBox.add(famLabel); if (famList.size() > 0) { JPanel famBtnBox = new JPanel(); famBtnBox.setLayout(new BoxLayout(famBtnBox, BoxLayout.LINE_AXIS)); Dimension sizer2 = new Dimension(350, 50); String[] famMenu = genFamMenu(famList); famPick = new JComboBox(famMenu); famPick.addActionListener(listener); famPick.setActionCommand("view/edit family"); famPick.setMinimumSize(sizer2); famPick.setMaximumSize(sizer2); famPick.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.blue), "View/Edit Family")); famBtnBox.add(famPick); populationBox.add(famBtnBox); } // end of if-any-families-exist rebuilding = false; } // end of method buildPopulationBox
private static Box getVagaLivre() { Box box = null; for (int i = 0; i < 50; i++) { for (int j = 0; j < 10; j++) { box = vagas[i][j]; if (box.getCarro() == null) return box; } } return null; }
E nextEvent() { Box res = bs.get(0); double min = res.flowtime(); for (Box b : bs) if (b.flowtime() < min) { min = b.flowtime(); res = b; } return new F(res, time + min); }
/** OptionPaneDemo Constructor */ public OptionPaneDemo(SwingSet2 swingset) { // Set the title for this demo, and an icon used to represent this // demo inside the SwingSet2 app. super(swingset, "OptionPaneDemo", "toolbar/JOptionPane.gif"); JPanel demo = getDemoPanel(); demo.setLayout(new BoxLayout(demo, BoxLayout.X_AXIS)); JPanel bp = new JPanel() { public Dimension getMaximumSize() { return new Dimension(getPreferredSize().width, super.getMaximumSize().height); } }; bp.setLayout(new BoxLayout(bp, BoxLayout.Y_AXIS)); bp.add(Box.createRigidArea(VGAP30)); bp.add(Box.createRigidArea(VGAP30)); bp.add(createInputDialogButton()); bp.add(Box.createRigidArea(VGAP15)); bp.add(createWarningDialogButton()); bp.add(Box.createRigidArea(VGAP15)); bp.add(createMessageDialogButton()); bp.add(Box.createRigidArea(VGAP15)); bp.add(createComponentDialogButton()); bp.add(Box.createRigidArea(VGAP15)); bp.add(createConfirmDialogButton()); bp.add(Box.createVerticalGlue()); demo.add(Box.createHorizontalGlue()); demo.add(bp); demo.add(Box.createHorizontalGlue()); }
/** * Update the dialog contents. * * @param jheader The job portion of the dialog header. * @param job The queue job. * @param info The current job status information. */ public void updateContents( String jheader, QueueJob job, QueueJobInfo info, SubProcessExecDetails details) { ActionAgenda agenda = job.getActionAgenda(); QueueJobResults results = info.getResults(); String dir = "-"; if ((agenda != null) && (info.getOsType() != null)) dir = agenda.getTargetPath(info.getOsType()).toString(); String hostname = ""; if (info.getHostname() != null) hostname = (" [" + info.getHostname() + "]"); String command = "-"; if (details != null) command = details.getCommand(); TreeMap<String, String> env = new TreeMap<String, String>(); if (details != null) env = details.getEnvironment(); setHeader("Execution Details -" + jheader + hostname); pWorkingDirField.setText(dir); BaseAction action = job.getAction(); pCommandLineLabel.setText( "Action Command: " + action.getName() + " (v" + action.getVersionID() + ")"); pCommandLineArea.setText(command); { Component comps[] = UIFactory.createTitledPanels(); { JPanel tpanel = (JPanel) comps[0]; JPanel vpanel = (JPanel) comps[1]; if (!env.isEmpty()) { String last = env.lastKey(); for (String key : env.keySet()) { String value = env.get(key); JTextField field = UIFactory.createTitledTextField(tpanel, key + ":", sTSize, vpanel, value, sVSize); field.setHorizontalAlignment(JLabel.LEFT); if (!key.equals(last)) UIFactory.addVerticalSpacer(tpanel, vpanel, 3); } } else { tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0))); vpanel.add(Box.createHorizontalGlue()); } } pEnvLabel.setText("Toolset Environment: " + agenda.getToolset()); pEnvScroll.setViewportView(comps[2]); } }
void initComponents() { JPanel mainPanel = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); Color bgColor = Color.getHSBColor(0.58f, 0.17f, 0.95f); buttonPanel.setBackground(bgColor); Border empty = BorderFactory.createEmptyBorder(5, 5, 5, 5); buttonPanel.setBorder(empty); textField = new JTextField(75); buttonPanel.add(textField); buttonPanel.add(Box.createHorizontalStrut(10)); searchPHI = new JButton("Search PHI"); searchPHI.addActionListener(this); buttonPanel.add(searchPHI); buttonPanel.add(Box.createHorizontalStrut(10)); searchTrial = new JButton("Search Trial IDs"); searchTrial.addActionListener(this); buttonPanel.add(searchTrial); buttonPanel.add(Box.createHorizontalStrut(20)); buttonPanel.add(Box.createHorizontalGlue()); saveAs = new JCheckBox("Save As..."); saveAs.setBackground(bgColor); buttonPanel.add(saveAs); mainPanel.add(buttonPanel, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(); textPane = new ColorPane(); // textPane.setEditable(false); scrollPane.setViewportView(textPane); mainPanel.add(scrollPane, BorderLayout.CENTER); JPanel footerPanel = new JPanel(); footerPanel.setLayout(new BoxLayout(footerPanel, BoxLayout.X_AXIS)); footerPanel.setBackground(bgColor); message = new JLabel("Ready..."); footerPanel.add(message); mainPanel.add(footerPanel, BorderLayout.SOUTH); setTitle(windowTitle); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); getContentPane().add(mainPanel, BorderLayout.CENTER); pack(); centerFrame(); }
public ConstraintsPanel() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(new DisplayUserDirectory()); add(Box.createVerticalStrut(15)); add(new DisplayParentDirectory("", "", false)); add(Box.createVerticalStrut(15)); add(new DisplayTemplate("", "")); add(Box.createVerticalStrut(15)); add(new DisplayResults()); add(Box.createVerticalStrut(15)); }
void run() { Scanner sc = new Scanner(System.in); int oo = sc.nextInt(); for (int o = 1; o <= oo; o++) { que = new PriorityQueue<E>(); int n = sc.nextInt(); tank = new Tank(); count = 0; int[] h = new int[n + 3], b = new int[n + 3]; h[0] = 100; b[0] = 0; h[n + 1] = 50; b[n + 1] = 100; h[n + 2] = 50; b[n + 2] = INF; for (int i = 1; i <= n; i++) { b[i] = sc.nextInt(); h[i] = sc.nextInt(); } n += 3; for (int i = 1; i < n; i++) { tank.bs.add(new Box(b[i - 1], b[i], h[i - 1], h[i], 0, 0)); } int m = sc.nextInt(); for (int i = 0; i < m; i++) { int f = sc.nextInt(); double a = sc.nextDouble() / 30; for (Box box : tank.bs) { if (box.b1 < f && f < box.b2) box.f += a; } } debug(tank.bs); int l = sc.nextInt(); res = new double[l]; for (int i = 0; i < l; i++) { que.offer(new W(sc.nextInt(), sc.nextDouble(), i)); } que.offer(tank.nextEvent()); debug(que.size()); while (!que.isEmpty()) { if (res[0] < 0) System.exit(1); que.poll().go(); debug(que.peek().time()); debug(tank.bs); debug(res); debug(); if (count == l) break; } for (double r : res) { System.out.println(r); } } }
/** Constructor. */ public TilePatternsView() { super(); tilePatternIcons = new ArrayList<TilePatternIcon>(); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // tileset properties // the tile pattern list // view of the current tile pattern // tileset properties tilesetPropertiesView = new TilesetPropertiesView(); tilesetPropertiesView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 120)); tilesetPropertiesView.setAlignmentX(Component.LEFT_ALIGNMENT); // list tilePatternsListModel = new TilePatternsListModel(); tilePatternsList = new JList(tilePatternsListModel); tilePatternsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tilePatternsList.setLayoutOrientation(JList.HORIZONTAL_WRAP); tilePatternsList.setVisibleRowCount(-1); // make the rows as wide as possible tilePatternsList .getSelectionModel() .addListSelectionListener(new TilePatternListSelectionListener()); tilePatternsList.setCellRenderer(new TilePatternListRenderer()); tilePatternsList.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_DELETE) { if (tileset != null && tileset.getSelectedTilePattern() != null) { tileset.removeTilePattern(); } } } }); JScrollPane listScroller = new JScrollPane(tilePatternsList); listScroller.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); listScroller.setAlignmentX(Component.LEFT_ALIGNMENT); // tile view tilePatternView = new TilePatternView(); tilePatternView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 300)); tilePatternView.setAlignmentX(Component.LEFT_ALIGNMENT); add(tilesetPropertiesView); add(Box.createRigidArea(new Dimension(0, 5))); add(listScroller); add(Box.createRigidArea(new Dimension(0, 5))); add(tilePatternView); }
public static Box localizarCarro(String placa) { Box box = null; for (int i = 0; i < 50; i++) { for (int j = 0; j < 10; j++) { box = vagas[i][j]; Carro carro = box.getCarro(); if (carro != null && carro.getPlaca().compareTo(placa) == 0) return box; } } return null; }
/** * Create the toolbar. By default this reads the resource file for the definition of the toolbar. */ private Component createToolbar() { toolbar = new JToolBar(); for (String toolKey : getToolBarKeys()) { if (toolKey.equals("-")) { toolbar.add(Box.createHorizontalStrut(5)); } else { toolbar.add(createTool(toolKey)); } } toolbar.add(Box.createHorizontalGlue()); return toolbar; }
/** * Agrega un actor a la tabla de simbolos * * @param actor Actor a agregar a la lista * @return true si tuvo exito en insertar en la tabla de simbolos */ public boolean put(Box actor) { if (actor == null) { System.out.println("Actor mierda es falso"); return false; } if (tabla.get(actor.getX_nombre()) != null) { System.out.println("Ya esta ocupado el actor " + actor.getX_nombre()); return false; } tabla.put(actor.getX_nombre(), actor); return true; }
/** * Create the toolbar. By default this reads the resource file for the definition of the toolbar. */ private Component createToolbar() { toolbar = new JToolBar(); String[] toolKeys = SCSUtility.tokenize(getResourceString("toolbar")); for (int i = 0; i < toolKeys.length; i++) { if (toolKeys[i].equals("-")) { toolbar.add(Box.createHorizontalStrut(5)); } else { toolbar.add(createTool(toolKeys[i])); } } toolbar.add(Box.createHorizontalGlue()); return toolbar; }
public FooterPanel() { super(); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.setBackground(Color.getHSBColor(0.58f, 0.17f, 0.95f)); subdirectories = new JCheckBox("Include subdirectories"); subdirectories.setBackground(background); this.add(subdirectories); this.add(Box.createHorizontalGlue()); extensionButton = new JButton(filter.getDescription()); this.add(extensionButton); this.add(Box.createHorizontalStrut(17)); extensionButton.addActionListener(this); }
private JPanel getParamsPanel() { JPanel paramsPanel = new JPanel(); Box b2 = Box.createVerticalBox(); JComponent indTestParamBox = getIndTestParamBox(); if (indTestParamBox != null) { b2.add(indTestParamBox); } paramsPanel.add(b2); paramsPanel.setBorder(new TitledBorder("Parameters")); return paramsPanel; }
public static void localizarBox(int numeroBox) { Box box = null; boolean achou = false; for (int i = 0; achou == false; i++) { for (int j = 0; achou == false; j++) { box = vagas[i][j]; if (box.getNumero() == numeroBox) { JOptionPane.showMessageDialog( null, " Box: " + numeroBox + "\n Andar: " + i + "\n Box: " + j); achou = true; } } } }
public long getDataOffset() { Object b = this; long offset = 16; while (b instanceof Box) { for (Box box : ((Box) b).getParent().getBoxes()) { if (b == box) { break; } offset += box.getSize(); } b = ((Box) b).getParent(); } return offset; }
public DisplayResults() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; text.setForeground(Color.black); add(text, gbc); gbc.gridy = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; add(emptyLabel, gbc); add(Box.createVerticalStrut(0), gbc); add(emptyLabel, gbc); /* gbc.gridy = 1; VTextMsg result = new VTextMsg(sshare, vnmrif, null); result.setPreferredSize(new Dimension(300, 30)); result.setForeground(Color.black); add( result, gbc ); */ setBorder( new CompoundBorder( BorderFactory.createTitledBorder(" Results "), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
public UpdateOrStatusOptionsDialog(Project project, Map<Configurable, AbstractVcs> confs) { super(project); setTitle(getRealTitle()); myProject = project; if (confs.size() == 1) { myMainPanel = new JPanel(new BorderLayout()); final Configurable configurable = confs.keySet().iterator().next(); addComponent(confs.get(configurable), configurable, BorderLayout.CENTER); myMainPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH); } else { myMainPanel = new JBTabbedPane(); final ArrayList<AbstractVcs> vcses = new ArrayList<>(confs.values()); Collections.sort( vcses, new Comparator<AbstractVcs>() { public int compare(final AbstractVcs o1, final AbstractVcs o2) { return o1.getDisplayName().compareTo(o2.getDisplayName()); } }); Map<AbstractVcs, Configurable> vcsToConfigurable = revertMap(confs); for (AbstractVcs vcs : vcses) { addComponent(vcs, vcsToConfigurable.get(vcs), vcs.getDisplayName()); } } init(); }
public LibraryManagerUI(Frame parent, Platform platform) { super(parent, "Library Manager", Dialog.ModalityType.APPLICATION_MODAL, _("Unable to reach Arduino.cc due to possible network issues.")); this.platform = platform; filtersContainer.add(new JLabel(_("Topic")), 1); filtersContainer.remove(2); typeChooser = new JComboBox(); typeChooser.setMaximumRowCount(20); typeChooser.setEnabled(false); filtersContainer.add(Box.createHorizontalStrut(5), 0); filtersContainer.add(new JLabel(_("Type")), 1); filtersContainer.add(Box.createHorizontalStrut(5), 2); filtersContainer.add(typeChooser, 3); }