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); }
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 ReplyView(MikroEventModel e, EventViewManager m) { super(); evm = m; textArea = new JTextArea("@" + evm.event.getAuthor() + " ", 4, 45); Font f = new Font("Nimbus Sans L Bold", Font.PLAIN, 15); textArea.setFont(f); textArea.setLineWrap(true); ((AbstractDocument) textArea.getDocument()).setDocumentFilter(new DocumentSizeFilter(140)); buttonPanel = new JPanel(); submitButton = new JButton("Post"); cancelButton = new JButton("Cancel"); submitButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { evm.reply(textArea.getText()); } }); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { evm.setEventView(); } }); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(submitButton); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(cancelButton); this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); this.add(textArea); this.add(buttonPanel); }
public Box createBox(TeXEnvironment env) { TeXFont tf = env.getTeXFont(); int style = env.getStyle(); Box b = base != null ? base.createBox(env) : new StrutBox(0, 0, 0, 0); float sep = new SpaceAtom(TeXConstants.UNIT_POINT, 1f, 0, 0).createBox(env).getWidth(); Box arrow; if (dble) { arrow = XLeftRightArrowFactory.create(env, b.getWidth()); sep = 4 * sep; } else { arrow = XLeftRightArrowFactory.create(left, env, b.getWidth()); sep = -sep; } VerticalBox vb = new VerticalBox(); if (over) { vb.add(arrow); vb.add(new HorizontalBox(b, arrow.getWidth(), TeXConstants.ALIGN_CENTER)); float h = vb.getDepth() + vb.getHeight(); vb.setDepth(b.getDepth()); vb.setHeight(h - b.getDepth()); } else { vb.add(new HorizontalBox(b, arrow.getWidth(), TeXConstants.ALIGN_CENTER)); vb.add(new StrutBox(0, sep, 0, 0)); vb.add(arrow); float h = vb.getDepth() + vb.getHeight(); vb.setDepth(h - b.getHeight()); vb.setHeight(b.getHeight()); } return vb; }
/** * Paint the children of this box. * * @param context LayoutContext to use. * @param x x-coordinate at which to paint * @param y y-coordinate at which to paint */ protected void paintChildren(LayoutContext context, int x, int y) { Box[] children = this.getChildren(); for (int i = 0; children != null && i < children.length; i++) { Box child = children[i]; child.paint(context, x + child.getX(), y + child.getY()); } }
public Box createBox(TeXEnvironment env) { TreeEditor.addAtoms(this); TeXFont tf = env.getTeXFont(); int style = env.getStyle(); Char c = tf.getChar(name, style); Box cb = new CharBox(c); if (env.getSmallCap() && unicode != 0 && Character.isLowerCase(unicode)) { try { cb = new ScaleBox( new CharBox( tf.getChar( TeXFormula.symbolTextMappings[Character.toUpperCase(unicode)], style)), 0.8, 0.8); } catch (SymbolMappingNotFoundException e) { } } if (type == TeXConstants.TYPE_BIG_OPERATOR) { if (style < TeXConstants.STYLE_TEXT && tf.hasNextLarger(c)) c = tf.getNextLarger(c, style); cb = new CharBox(c); cb.setShift( -(cb.getHeight() + cb.getDepth()) / 2 - env.getTeXFont().getAxisHeight(env.getStyle())); float delta = c.getItalic(); HorizontalBox hb = new HorizontalBox(cb); if (delta > TeXFormula.PREC) hb.add(new StrutBox(delta, 0, 0, 0)); usedBox = hb; return hb; } usedBox = cb; return cb; }
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 List<Box> getInvalidBoxes() { List<Box> invalidBoxes = new ArrayList<Box>(); for (Box box : boxes) { if (!box.isValid()) invalidBoxes.add(box); } return invalidBoxes; }
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 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); }
@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 static void main(String[] args) { // 1:把命令和真正的实现组合起来,相当于在组装机器, // 把机箱上按钮的连接线插接到主板上。 MainBoardApi mainBoard = new GigaMainBoard(); OpenCommand openCommand = new OpenCommand(mainBoard); // 2:为机箱上的按钮设置对应的命令,让按钮知道该干什么 Box box = new Box(); box.setOpenCommand(openCommand); // 3:然后模拟按下机箱上的按钮 box.openButtonPressed(); // 结果 // 技嘉主板现在正在开机,请等候 // 接通电源...... // 设备检查...... // 装载系统...... // 机器正常运转起来...... // 机器已经正常打开,请操作 }
public static void ocuparVaga(Carro carro, int hora, int minuto) { Box box = getVagaLivre(); if (box != null) { box.setCarro(carro); box.setHorarioEntrada(hora, minuto); } }
/** * Set value to the element. The value will not be set if any of the following exceptions happen * * <p>Sets a value to the element. * * <p>If val = null, it removes the existing value in the element. * * <p>Throws OutOfBoundaryException if the input value is invalid (outside the valid alphabet * range). * * <p>Throws DuplicateException if the new value conflicts with one or more of the sequences that * the element is associated with. * * @param val the value to be set. Null if you want to empty the element. * @throws OutOfBoundaryException The entered value is out-of-boundary * @throws DuplicateException The entered value conflicts with some of the related sequences. The * information of the conflicts is included in the DuplicateException object. */ public void setVal(Character val) throws OutOfBoundaryException, DuplicateException { if (val == null) this.val = -1; else { if (!super.getAlphabet().isValidChar(val)) throw new OutOfBoundaryException(); // TODO DuplicateException ArrayList<Character> notExistedVal = getCandidates(); if (!notExistedVal.contains(val)) { List<Sequence> seq = new ArrayList<Sequence>(); List<Element> conflictEleList = new ArrayList<Element>(); if (box.findElement(val) != null) { seq.add(box); conflictEleList.add(box.findElement(val)); } if (row.findElement(val) != null) { seq.add(row); conflictEleList.add(row.findElement(val)); } if (col.findElement(val) != null) { seq.add(col); conflictEleList.add(col.findElement(val)); } throw new DuplicateException(seq, conflictEleList); } // for(int i=0;i<existedVal.size();i++) // if(val == existedVal.get(i)) // throw new DuplicateException(null,null); this.val = getAlphabet().getPosition(val); } }
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()); }
public static void main(String[] args) { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.scan("com.vamsi"); ctx.refresh(); for (String beanname : ctx.getBeanDefinitionNames()) { System.out.println(beanname); } HollywoodServiceJSR330 hollywoodservice = ctx.getBean("hollywoodServiceJSR330", HollywoodServiceJSR330.class); hollywoodservice.getFriendlyAgents(); Box<Integer> abox = ctx.getBean("intBox", Box.class); abox.setA(100); System.out.println("first bean " + abox.getA()); Box<Integer> bbox = ctx.getBean("intBox", Box.class); System.out.println("second bean " + abox.getA()); ctx.close(); }
/** @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(); } } } }
/** * 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(); } }
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 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 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 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; }
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; }
/** * 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); }
void g(double ntime) { double dt = ntime - time; time = ntime; for (Box b : bs) { b.go(dt); } }
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)); }
private static void assertChooser() { if (fc == null) { fc = new JFileChooser(); Box ab = new Box(BoxLayout.Y_AXIS); ab.add(afap = new AudioFormatAccessoryPanel("Sample format")); ab.add(sap = new SaveAccessoryPanel(null)); fc.setAccessory(ab); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setFileFilter( new FileFilter() { public boolean accept(File f) { return f.isDirectory() && !f.equals(Zoeos.getZoeosLocalDir()); } public String getDescription() { return "Directories"; } }); fc.setAcceptAllFileFilterUsed(false); } try { fc.setCurrentDirectory(new File(ZPREF_lastDir.getValue())); } catch (Exception e) { } }
public void draw(Graphics2D g2, float x, float y) { float yPos = y - height; for (Box b : children) { yPos += b.getHeight(); b.draw(g2, x + b.getShift() - leftMostPos, yPos); yPos += b.getDepth(); } }
public AuthorAnnotationEditor() { // field is added in super constructor box.add(author); box.add(value); box.setBorder(Borders.EMPTY_BORDER); }