/** * Introduce the Scout449 program! * * @param stat the Scout449 responsible for this object */ public Intro(Scout449 stat) { super("Loading Scout449"); setVisible(false); setUndecorated(true); setIconImage(stat.getImage("winicon")); loadImage(); getRootPane().putClientProperty("Window.shadow", Boolean.FALSE); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); Container c = getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); c.add(Box.createVerticalGlue()); Loading load = new Loading(); load.setOpaque(true); load.setAlignmentX(JComponent.CENTER_ALIGNMENT); c.add(load); setCursor(Constants.WAIT); c.add(Box.createVerticalGlue()); // center the window Dimension ss = AppLib.winInfo.getScreenSize(); setBounds( (ss.width - Constants.INTRO_WIDTH) / 2, (ss.height - Constants.INTRO_HEIGHT) / 2, Constants.INTRO_WIDTH, Constants.INTRO_HEIGHT); setVisible(true); }
public DateTimeView(DateTime time) { super(); this.time = time; Font f = new Font("Monospaced", Font.BOLD, 13); Color c = new Color(44, 68, 152); month = new JLabel(strMonth(time.getMonthOfYear())); month.setFont(f); month.setForeground(c); year = new JLabel("" + time.getYear()); year.setFont(f); year.setForeground(c); day = new JLabel("" + time.getDayOfMonth()); day.setFont(new Font("Calibri", Font.BOLD, 26)); day.setForeground(new Color(126, 148, 227)); t = new JLabel(formatTime(time.getHourOfDay(), time.getMinuteOfHour())); t.setFont(f); t.setForeground(c); JPanel topPanel = new JPanel(); topPanel.setLayout(new FlowLayout()); topPanel.add(month); topPanel.add(year); this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); topPanel.setAlignmentX(Component.CENTER_ALIGNMENT); this.add(topPanel); this.add(Box.createVerticalStrut(3)); day.setAlignmentX(Component.CENTER_ALIGNMENT); this.add(day); t.setAlignmentX(Component.CENTER_ALIGNMENT); this.add(Box.createVerticalStrut(3)); this.add(t); this.setBorder(BorderFactory.createRaisedBevelBorder()); }
private Component createOptionsPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); hideButton = new JButton( new AbstractAction("Hide") { public void actionPerformed(ActionEvent e) { hideSelected(); } }); showButton = new JButton( new AbstractAction("Show") { public void actionPerformed(ActionEvent e) { showSelected(); } }); panel.add(showButton); panel.add(Box.createHorizontalStrut(10)); panel.add(hideButton); panel.add(Box.createHorizontalGlue()); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); return panel; }
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(); }
@Inject public CheckoutPanel(BookInventory inventory, CreditCardService cardService, Logger logger) { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.logger = logger; this.cartTableModel = new CartTableModel(); final CheckoutInventoryTableModel inventoryModel = new CheckoutInventoryTableModel(inventory); inventoryModel.addTableModelListener( new TableModelListener() { public void tableChanged(TableModelEvent event) { if (inventoryModel.isLastColumn(event.getColumn())) { for (int i = event.getFirstRow(); i <= event.getLastRow(); i++) { addToCart(inventoryModel.decrementInventry(event.getFirstRow())); } } } }); this.add(new JScrollPane(new CheckoutInventoryTable(inventoryModel))); this.add(Box.createVerticalStrut(20)); this.add(new JScrollPane(new CartTable(cartTableModel))); this.add(Box.createVerticalStrut(20)); this.add(new PaymentPanel(cardService)); this.add(Box.createVerticalGlue()); this.setPreferredSize(new Dimension(600, 400)); }
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)); }
protected JComponent createCenterPanel() { JPanel contentPanel = new JPanel(new BorderLayout()); Box mainPanel = Box.createHorizontalBox(); myClassFilterEditor = new ClassFilterEditor( myProject, myChooserFilter, "reference.viewBreakpoints.classFilters.newPattern"); myClassFilterEditor.setPreferredSize(new Dimension(400, 200)); myClassFilterEditor.setBorder( IdeBorderFactory.createTitledBorder( DebuggerBundle.message("class.filters.dialog.inclusion.filters.group"), false, false, true)); mainPanel.add(myClassFilterEditor); myClassExclusionFilterEditor = new ClassFilterEditor( myProject, myChooserFilter, "reference.viewBreakpoints.classFilters.newPattern"); myClassExclusionFilterEditor.setPreferredSize(new Dimension(400, 200)); myClassExclusionFilterEditor.setBorder( IdeBorderFactory.createTitledBorder( DebuggerBundle.message("class.filters.dialog.exclusion.filters.group"), false, false, true)); mainPanel.add(myClassExclusionFilterEditor); contentPanel.add(mainPanel, BorderLayout.CENTER); return contentPanel; }
public static void ocuparVaga(Carro carro, int hora, int minuto) { Box box = getVagaLivre(); if (box != null) { box.setCarro(carro); box.setHorarioEntrada(hora, minuto); } }
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; }
public void createGUI() { HUDTitleBar titlePanel = new HUDTitleBar(headerImage, headerImage); add(titlePanel, BorderLayout.NORTH); titlePanel.installListeners(); createProgressScreen(); JPanel exportOptionContainer = new JPanel(); exportOptionContainer.setLayout(new BoxLayout(exportOptionContainer, BoxLayout.PAGE_AXIS)); exportOptionContainer.add(createCompressionRateChoiceUI()); exportOptionContainer.add(Box.createVerticalStrut(20)); exportOptionContainer.add(createSelectOutputDirectoryUI()); exportOptionContainer.add(Box.createVerticalStrut(20)); exportOptionContainer.add(createCreateArchiveButtonUI()); swappableContainer.add(exportOptionContainer, BorderLayout.CENTER); add(swappableContainer, BorderLayout.CENTER); ((JComponent) getContentPane()).setBorder(new LineBorder(UIHelper.LIGHT_GREEN_COLOR, 2, true)); addWindowListener(this); pack(); setVisible(true); }
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 jbInit() throws Exception { box1 = Box.createVerticalBox(); this.getContentPane().setLayout(borderLayout1); close.setText("Close"); close.addActionListener(new CellHelpWindow_close_actionAdapter(this)); jLabel1.setText("Recommendation"); jLabel2.setText("Description"); jPanel1.setLayout(borderLayout2); jPanel2.setLayout(borderLayout3); description.setText("jTextPane1"); description.setContentType("text/html"); scp1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scp1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scp1.setToolTipText(""); recom.setText(""); recom.setContentType("text/html"); this.getContentPane().add(box1, BorderLayout.CENTER); box1.add(jPanel1, null); box1.add(jPanel2, null); this.getContentPane().add(jPanel3, BorderLayout.SOUTH); jPanel3.add(close, null); jPanel2.add(jLabel1, BorderLayout.NORTH); jPanel2.add(scp2, BorderLayout.CENTER); scp2.getViewport().add(recom, null); jPanel2.add(scp2, BorderLayout.CENTER); jPanel1.add(jLabel2, BorderLayout.NORTH); jPanel1.add(scp1, BorderLayout.CENTER); scp1.getViewport().add(description, null); }
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))); }
/** * Description: <br> * Copyright (C), 2005-2008, Yeeku.H.Lee <br> * This program is protected by copyright laws. <br> * Program Name: <br> * Date: * * @author Yeeku.H.Lee [email protected] * @version 1.0 */ public class TestBoxSpace { private Frame f = new Frame("测试"); // 定义水平摆放组件的Box对象 private Box horizontal = Box.createHorizontalBox(); // 定义垂直摆放组件的Box对象 private Box vertical = Box.createVerticalBox(); public void init() { horizontal.add(new Button("水平按钮一")); horizontal.add(Box.createHorizontalGlue()); horizontal.add(new Button("水平按钮二")); // 水平方向不可拉伸的间距,其宽度为10px horizontal.add(Box.createHorizontalStrut(10)); horizontal.add(new Button("水平按钮三")); vertical.add(new Button("垂直按钮一")); vertical.add(Box.createVerticalGlue()); vertical.add(new Button("垂直按钮二")); // 垂直方向不可拉伸的间距,其高度为10px vertical.add(Box.createVerticalStrut(10)); vertical.add(new Button("垂直按钮三")); f.add(horizontal, BorderLayout.NORTH); f.add(vertical); f.pack(); f.setVisible(true); } public static void main(String[] args) { new TestBoxSpace().init(); } }
public PaymentPanel(final CreditCardService cardService) { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); add(new JLabel("Credit Card")); add(Box.createHorizontalStrut(5)); final JTextField creditCard = new JTextField(30); add(creditCard); add(Box.createHorizontalStrut(5)); JButton purchase = new JButton("Purchase"); purchase.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { double total = cartTableModel.getTotal(); String cardNumber = creditCard.getText(); String confirmation = "Do you want to charge " + total + " to your " + cardNumber + " card?"; String title = "Confirm charge"; int confirm = JOptionPane.showConfirmDialog( PaymentPanel.this, confirmation, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.YES_OPTION) { CreditCard card = new CreditCard(cardNumber); cardService.debit(card, total); } } }); add(Box.createHorizontalStrut(5)); add(purchase); }
public HelpUI(Frame parent, String title) { sidebar = new Sidebar(); sidebar.setBorder(new EmptyBorder(10, 10, 10, 10)); infoView = new JTextPane(); Dimension d1 = sidebar.getPreferredSize(); infoView.setPreferredSize(new Dimension(d1.width * 3, d1.height - 5)); infoView.setEditable(false); MouseAdapter ma = new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { SidebarOption sopt = (SidebarOption) me.getComponent(); if (sel != null) { sel.setSelected(false); sel.repaint(); } sel = sopt; sel.setSelected(true); sel.repaint(); renderInfo(); } }; general = new SidebarOption("General Info", HELP_GENERAL_LOC); general.addMouseListener(ma); sidebar.add(general); sidebar.add(Box.createVerticalStrut(scy(10))); artifact = new SidebarOption("Artifacts", HELP_ARTIFACTS_LOC); artifact.addMouseListener(ma); sidebar.add(artifact); sidebar.add(Box.createVerticalStrut(scy(10))); net = new SidebarOption("Networking", HELP_NET_LOC); net.addMouseListener(ma); sidebar.add(net); sidebar.add(Box.createVerticalStrut(scy(10))); gpl = new SidebarOption("License", HELP_GPL_LOC); gpl.addMouseListener(ma); sidebar.add(gpl); general.setSelected(true); sel = general; sidebar.add(Box.createVerticalGlue()); add(BorderLayout.WEST, sidebar); add(BorderLayout.CENTER, new JScrollPane(infoView)); setResizable(false); pack(); setLocationRelativeTo(parent); setTitle(title); renderInfo(); }
public ActionBar(View view, boolean temp) { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.view = view; this.temp = temp; add(Box.createHorizontalStrut(2)); JLabel label = new JLabel(jEdit.getProperty("view.action.prompt")); add(label); add(Box.createHorizontalStrut(12)); add(action = new ActionTextField()); action.setEnterAddsToHistory(false); Dimension max = action.getPreferredSize(); max.width = Integer.MAX_VALUE; action.setMaximumSize(max); action.addActionListener(new ActionHandler()); action.getDocument().addDocumentListener(new DocumentHandler()); if (temp) { close = new RolloverButton(GUIUtilities.loadIcon("closebox.gif")); close.addActionListener(new ActionHandler()); close.setToolTipText(jEdit.getProperty("view.action.close-tooltip")); add(close); } this.temp = temp; }
@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); }
/** Creates the main pane of the dialog. */ protected Component createPreferencesPane() { str = ResourceBundle.getBundle("org.pegadi.lister.PrefsDialogStrings"); Box pane = new Box(BoxLayout.Y_AXIS); Border b; JPanel selectionPane = new JPanel(); selectionPane.setLayout(new BoxLayout(selectionPane, BoxLayout.Y_AXIS)); ButtonGroup selectionGroup = new ButtonGroup(); b = BorderFactory.createTitledBorder(str.getString("selection_title")); selectionPane.setBorder(b); lastRadio = new JRadioButton(str.getString("selection_last")); selectionGroup.add(lastRadio); selectionPane.add(lastRadio); defaultRadio = new JRadioButton(str.getString("selection_default")); selectionGroup.add(defaultRadio); selectionPane.add(defaultRadio); pane.add(selectionPane); /** * **************************************************************** JPanel scorePanel = new * JPanel(new GridBagLayout()); b = * BorderFactory.createTitledBorder(str.getString("score_title")); scorePanel.setBorder(b); * * <p>scoreCheck = new JCheckBox(str.getString("score_label")); scorePanel.add(scoreCheck, new * GridBagConstraints2(0, 0, 2, 1, 1.0, 0.0 ,GridBagConstraints.NORTHWEST, * GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); * * <p>scorePanel.add(new JLabel(str.getString("score_hi_label")), new GridBagConstraints2(0, 1, * 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, * 5), 0, 0)); * * <p>topScoreField = new JTextField(4); scorePanel.add(topScoreField, new * GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST, * GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); * * <p>scorePanel.add(new JLabel(str.getString("score_day_label")), new GridBagConstraints2(0, 2, * 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, * 5), 0, 0)); * * <p>dayScoreField = new JTextField(4); scorePanel.add(dayScoreField, new * GridBagConstraints2(1, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST, * GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); * * <p>scorePanel.add(new JLabel(str.getString("score_pers_label")), new GridBagConstraints2(0, * 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, * 5), 0, 0)); * * <p>personalScoreField = new JTextField(4); scorePanel.add(personalScoreField, new * GridBagConstraints2(1, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, * new Insets(5, 5, 5, 5), 0, 0)); * * <p>pane.add(scorePanel); *************************************************************** */ return pane; }
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
void updateToolbar() { if (myToolbar != null) { myNorthPanel.remove(myToolbar); } myToolbar = createToolbar(); myNorthPanel.add(myToolbar); updateToolbarVisibility(); myContentPane.revalidate(); }
private void createLayout() { getRootPane().setDefaultButton(mOKCancelPanel.getOKButton()); JPanel mainPanel = new JPanel(new BorderLayout()); Box centerPanel = new Box(BoxLayout.Y_AXIS); centerPanel.add(mLifeCycleStatePanel); mainPanel.add(centerPanel, BorderLayout.CENTER); mainPanel.add(mOKCancelPanel, BorderLayout.SOUTH); setContentPane(mainPanel); pack(); }
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; }
/** 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()); }
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 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; }
// override this to catch stop falling events protected void stopped_falling() { if (colliding_box_ != null) { y_ = colliding_box_.y() - colliding_box_.get_height() / 2 - Settings.BOX_GAP - get_height() / 2; } if (drive_this_height_ != null) drive_this_height_.set_y(y_); }
/** * Méthode de création du panelInit * * @return */ private JPanel createPanelInit() { JPanel panRight = new JPanel(); panRight.setLayout(new BoxLayout(panRight, BoxLayout.Y_AXIS)); butListParty = new JButton("Liste des parties"); butListParty.addActionListener(this); JPanel panCreate = new JPanel(); panCreate.setLayout(new BoxLayout(panCreate, BoxLayout.X_AXIS)); textCreate = new JTextField("", 40); textCreate.setMaximumSize(textCreate.getPreferredSize()); butCreateParty = new JButton("Creation de parties "); butCreateParty.addActionListener(this); SpinnerModel model = new SpinnerNumberModel(3, 2, 8, 1); spinNbPlayer = new JSpinner(model); spinNbPlayer.setMaximumSize(spinNbPlayer.getPreferredSize()); panCreate.add(new JLabel("Nouveau nom de partie : ")); panCreate.add(textCreate); panCreate.add(Box.createHorizontalStrut(20)); panCreate.add(new JLabel("Nombres de joueurs : ")); panCreate.add(spinNbPlayer); panCreate.add(butCreateParty); JPanel panJoin = new JPanel(); panJoin.setLayout(new BoxLayout(panJoin, BoxLayout.X_AXIS)); textJoin = new JTextField("", 2); textJoin.setMaximumSize(textJoin.getPreferredSize()); butJoinParty = new JButton("Rejoindre la partie "); butJoinParty.addActionListener(this); panJoin.add(new JLabel("Num Partie : ")); panJoin.add(textJoin); panJoin.add(butJoinParty); panRight.add(butListParty); panRight.add(panCreate); panRight.add(panJoin); panRight.add(Box.createVerticalGlue()); textInfoInit = new JTextArea(20, 100); textInfoInit.setLineWrap(true); JScrollPane scroll = new JScrollPane( textInfoInit, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JPanel panAll = new JPanel(); panAll.setLayout(new BoxLayout(panAll, BoxLayout.X_AXIS)); panAll.add(scroll); panAll.add(panRight); return panAll; }
/** 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); }
/** * 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]); } }