private void layoutMainPanel() { initComponents(); FormLayout layout = new FormLayout("p:g", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.appendTitle(rb.getString("Message.TransToPrint")); builder.append(ButtonBarFactory.buildLeftAlignedBar(selectButton, clearButton, invertButton)); builder.nextLine(); builder.appendUnrelatedComponentsGapRow(); builder.nextLine(); builder.appendRow(RowSpec.decode("f:75dlu:g")); builder.append(new JScrollPane(table)); builder.nextLine(); builder.appendUnrelatedComponentsGapRow(); builder.nextLine(); builder.append(ButtonBarFactory.buildOKCancelBar(okButton, cancelButton)); getContentPane().add(builder.getPanel(), BorderLayout.CENTER); pack(); setMinimumSize(getSize()); }
protected JComponent createMasterPanel() { final FormLayout layout = new FormLayout( "l:p,2dlu,f:max(p;50dlu):g(.3) ,3dlu " + "l:p,2dlu,f:max(p;50dlu):g(.3) ", ""); final DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.setRowGroupingEnabled(true); builder.append("Fecha", fecha); builder.append("F. Pago", formaDePago, true); builder.append("Banco", bancoOrigen); builder.append("Referencia", referencia, true); builder.append("Cuenta Depósito", cuentaDeposito, true); builder.append("Importe", importe); builder.append("Pago", buildPagosbox(model.getPagoMPModel().getModel("depositoRow")), true); builder.append("Disponible", disponible); builder.append("Por pagar", saldoTotal); builder.append("Pendiente", saldoPendiente, true); final CellConstraints cc = new CellConstraints(); builder.append("Comentario"); builder.appendRow(new RowSpec("17dlu")); builder.add(new JScrollPane(comentario), cc.xywh(builder.getColumn(), builder.getRow(), 5, 2)); builder.nextLine(2); builder.append("Condonar", condonar); builder.append("Tipo de Facturas", tipoDoctos, true); ComponentUtils.decorateSpecialFocusTraversal(builder.getPanel()); return builder.getPanel(); }
@Override protected void createPanel() { createFields(); FormLayout layout = new FormLayout("right:max(20dlu;pref), 3dlu, 40dlu, 0dlu, 126dlu", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.append( new JLabel("Use this data source to connect to a Winston Wave Server (WWS)."), 5); builder.nextLine(); builder.appendSeparator(); builder.append("IP Address or Host Name:"); builder.append(wwsHost, 3); builder.nextLine(); builder.append("Port:"); builder.append(wwsPort); builder.append(" Winston default: 16022"); builder.nextLine(); builder.append("Timeout:"); builder.append(wwsTimeout); builder.append(" seconds"); builder.nextLine(); builder.append("Use Compression:"); builder.append(wwsCompress); builder.nextLine(); panel = builder.getPanel(); }
private void initView() { this.setLayout(new BorderLayout()); JToolBar toolBar = new JToolBar(); ActionManager actionManager = Application.getInstance().getActionManager(); toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton()); add(toolBar, BorderLayout.NORTH); className = new TextAdapter(new JTextField()) { @Override protected void updateModel(String text) { setClassName(text); } }; FormLayout layout = new FormLayout("right:50dlu, 3dlu, fill:150dlu, 3dlu, fill:100", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.append("Class Name:", className.getComponent(), 3); add(builder.getPanel(), BorderLayout.CENTER); }
/** * Builds the panel. Initializes and configures components first, then creates a FormLayout, * configures the layout, creates a builder, sets a border, and finally adds the components. * * @return the built panel */ public JComponent createContentPanel() { FormLayout layout = new FormLayout( "p,3dlu,p,3dlu", // cols //$NON-NLS-1$ "p,10dlu,p,10dlu"); // rows //$NON-NLS-1$ // Create a builder that assists in adding components to the container. // Wrap the panel with a standardized border. DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); JEditorPane l = new JEditorPane("text/html", Messages.getString("LicenseDialog.Email")); l.setEditable(false); l.setOpaque(false); l.setFont(l.getFont().deriveFont(Font.PLAIN)); JLabel emailLabel = new JLabel(Messages.getString("LicenseDialog.EmailLabel") + ":"); // emailLabel.setFont(emailLabel.getFont().deriveFont(Font.PLAIN)); builder.add(l, cc.xyw(1, 1, 4)); builder.nextLine(2); builder.append(emailLabel, email); builder.nextLine(2); JComponent result = builder.getPanel(); return result; }
/** Create panel with aligned labels on the right and fields on the left. */ public static JPanel createForm( String title, Component[] leftComponents, Component[] rightComponents) { if (leftComponents.length != rightComponents.length) { throw new IllegalArgumentException( "Arrays must be the same size, instead got " + leftComponents.length + "and " + rightComponents.length); } int numRows = leftComponents.length; if (numRows == 0) { throw new IllegalArgumentException("Zero components."); } FormLayout layout = new FormLayout("right:100, 3dlu, left:300", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); if (title != null) { builder.appendSeparator(title); } for (int i = 0; i < numRows; i++) { builder.append(leftComponents[i], rightComponents[i]); builder.nextLine(); } return builder.getPanel(); }
public static JPanel makeDonatePanel(boolean border) { FormLayout layout = new FormLayout( "250px", // cols //$NON-NLS-1$ "p, 6dlu, p"); // rows //$NON-NLS-1$ DefaultFormBuilder builder = new DefaultFormBuilder(layout); if (border) builder.setDefaultDialogBorder(); JLabel msg = new JLabel(Messages.getString("Text.donateMessage")); builder.append(msg); builder.nextLine(2); ImageIcon icon = IconManager.getIcon("paypal.donate"); JButton donate = new JButton(icon); donate.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); builder.append(donate); donate.setEnabled(true); donate.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { BrowserControl.displayURL(donateUrl); } }); return builder.getPanel(); }
public void init(BarFormat format) { if (format == null) return; FormFormat form = format.getForm(); if (form == null) return; List boxes = form.getBoxes(); if (boxes == null || boxes.size() == 0) { return; } FormBoxLayout formBoxLayout = form.getLayout(zoom); FormLayout layout = new FormLayout(formBoxLayout.getColumnGrid(), formBoxLayout.getRowGrid()); /// DefaultFormBuilder builder = new DefaultFormBuilder(this,layout); DefaultFormBuilder builder = new DefaultFormBuilder(layout, this); if (formBoxLayout.getBorder() == null) builder.setDefaultDialogBorder(); else builder.setBorder(Borders.createEmptyBorder(formBoxLayout.getBorder())); CellConstraints cc = new CellConstraints(); for (Iterator i = boxes.iterator(); i.hasNext(); ) { FormBox box = (FormBox) i.next(); if (zoom < box.getMinZoom()) return; JComponent component; if (box.getFieldId() == null) component = new JLabel(Messages.getString(box.getTextId())); else { if (editor && !box.getField().isReadOnly()) { component = new ChangeAwareTextField(); component.setBorder(null); // component.setOpaque(false); } else component = new JLabel(); // if (box.getRow()==1&&!editor) // ((JLabel)component).setHorizontalAlignment(SwingConstants.CENTER); // bug workaround, not possible to center with classic method when rowSpan>1 fieldComponents.put(box.getFieldId(), component); } Font font = formBoxLayout.getFont(box.getFont()); if (font != null) component.setFont(font); String ba = box.getAlignment(); int bc = box.getColumn(); int br = box.getRow(); int bcs = box.getColumnSpan(); int brs = box.getRowSpan(); try { builder.add( component, (ba == null) ? cc.xywh(bc, br, bcs, brs) : cc.xywh(bc, br, bcs, brs, ba)); } catch (IndexOutOfBoundsException e) { log.fatal("box.Column(): " + bc); log.fatal("box.Row(): " + br); log.fatal("box.ColumnSpan(): " + bcs); log.fatal("box.RowSpan(): " + brs); log.fatal("box.Alignment(): " + ba); log.fatal("Occur Error: ", e); } } }
/* * (non-Javadoc) * @see com.luxsoft.siipap.swing.form2.AbstractForm#buildFormPanel() */ @Override protected JComponent buildFormPanel() { final FormLayout layout = new FormLayout("p,2dlu,max(p;100dlu)", ""); final DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.appendSeparator(""); if (model.getValue("id") != null) { JComponent ct = getControl("id"); ct.setEnabled(false); builder.append("Id", ct, true); } builder.append("Nombre", addMandatory("nombre"), true); return builder.getPanel(); }
@Override protected JComponent buildContent() { JPanel panel = new GradientBackgroundPanel(true); final FormLayout layout = new FormLayout( "max(p;50dlu),2dlu,max(p;90dlu):g(.5), 2dlu," + "max(p;50dlu),2dlu,max(p;90dlu):g(.5)", ""); final DefaultFormBuilder builder = new DefaultFormBuilder(layout, panel); builder.setLineGapSize(Sizes.DLUX4); updateTitleLabel(builder.append("Cliente", getControl("nombre"), 5)); builder.nextLine(); ActionLabel pedidoLabel = new ActionLabel("Pedido [F5]"); // pedidoLabel.addActionListener(EventHandler.create(ActionListener.class, this, // "mostrarPedido")); updateTitleLabel(pedidoLabel); dropComponent = new DropDownComponent( pedidoLabel, new HeaderPanel("Datos Generales", "Detalle del pedido"), true); pedidoLabel.addActionListener(dropComponent); builder.append(dropComponent, getControl("folio")); updateTitleLabel( builder.append("Fecha", getControl("fecha", new SimpleDateFormat("dd/MM/yyyy")))); builder.nextLine(); updateTitleLabel(builder.append("Tipo", getControl("origen"))); updateTitleLabel(builder.append("F.P.", getControl("formaDePago"))); builder.nextLine(); // builder.appendSeparator(); updateTitleLabel(builder.append("Cargos", getControl("comisionTarjetaImporte", moneyFormat))); // updateTitleLabel(builder.append("Flete",getControl("flete",moneyFormat))); updateTitleLabel(builder.append("Total", getControl("total", moneyFormat))); // builder.nextColumn(6); /*builder.append(""); builder.nextColumn(2); updateTitleLabel(builder.append("Total",getControl("total",moneyFormat))); */ builder.getPanel().setOpaque(false); builder.setDefaultDialogBorder(); JPanel content = new JPanel(new BorderLayout()); content.add(builder.getPanel(), BorderLayout.CENTER); content.add(new JSeparator(), BorderLayout.SOUTH); return content; }
private JComponent buildGeneralForm() { final FormLayout layout = new FormLayout("p,2dlu,p:g(.5), 2dlu," + "p,2dlu,p:g(.5)", ""); final DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.appendSeparator("Datos generales"); if (model.getValue("id") != null) { builder.append("Id", addReadOnly("id"), true); builder.append("Nombre", addReadOnly("nombre"), 5); } else { builder.append("Nombre", addMandatory("nombre"), 5); } builder.append("Suspendido", getControl("suspendido")); builder.append("Susp (Fecha)", addReadOnly("suspendidoFecha")); builder.append("Radio", getControl("radio"), 5); builder.append("Email-1", getControl("email1"), 5); builder.nextLine(); builder.append("Comentario", getControl("comentario"), 5); return builder.getPanel(); }
ApplicationDetailsDialog(final Root root) { super(root.getCoordinator().getMainFrame(), "Application Details - IceGrid Admin", true); setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); _mainFrame = root.getCoordinator().getMainFrame(); _name.setEditable(false); _uuid.setEditable(false); _createTime.setEditable(false); _createUser.setEditable(false); _updateTime.setEditable(false); _updateUser.setEditable(false); _revision.setEditable(false); FormLayout layout = new FormLayout("right:pref, 3dlu, pref", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.setRowGroupingEnabled(true); builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad()); builder.append("Name", _name); builder.nextLine(); builder.append("UUID", _uuid); builder.nextLine(); builder.append("Created", _createTime); builder.nextLine(); builder.append("Created by", _createUser); builder.nextLine(); builder.append("Last Update", _updateTime); builder.nextLine(); builder.append("Updated by", _updateUser); builder.nextLine(); builder.append("Revision", _revision); builder.nextLine(); Container contentPane = getContentPane(); contentPane.add(builder.getPanel()); pack(); setResizable(false); }
/** * Builds the panel. Initializes and configures components first, then creates a FormLayout, * configures the layout, creates a builder, sets a border, and finally adds the components. * * @return the built panel */ public JComponent createContentPanel() { // Separating the component initialization and configuration // from the layout code makes both parts easier to read. // TODO set minimum size FormLayout layout = new FormLayout( "180px", // cols //$NON-NLS-1$ "p, 6dlu, p,6dlu,p,6dlu,p"); // rows //$NON-NLS-1$ // Create a builder that assists in adding components to the container. // Wrap the panel with a standardized border. DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); JLabel logo = new JLabel(IconManager.getIcon("icon.projity")); logo.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent arg0) { BrowserControl.displayURL("http://www.projity.com"); // $NON-NLS-1$ } }); builder.append(logo); builder.nextLine(2); builder.append(link); // builder.nextLine(2); // builder.append(videos); if (Environment.isOpenProj()) { builder.nextLine(2); builder.append(tipOfTheDay); } builder.nextLine(2); builder.append(license); if (false || Environment.isOpenProj()) { // removed donation link JPanel p = new JPanel(); p.add(builder.getPanel()); // p.add(makeDonatePanel(false)); return p; } else return builder.getPanel(); }
private Component createViewComponent() { JTable table = new JTable(pm.getTableModel()); table.setSelectionModel( new SingleListSelectionAdapter(pm.getUserSelectionInList().getSelectionIndexHolder())); JPanel buttonBar = createButtonBar(); FormLayout layout = new FormLayout("p:grow", "p, 3dlu, fill:50px:grow, 3dlu, p"); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); JLabel titleLabel = new JLabel(" System Users"); titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 16f)); titleLabel.setBackground(new Color(227, 222, 198)); titleLabel.setOpaque(true); builder.add(titleLabel, cc.xy(1, 1)); builder.add(new JScrollPane(table), cc.xy(1, 3)); builder.add(buttonBar, cc.xy(1, 5)); return builder.getPanel(); }
private JPanel buildPanel() { FormLayout layout = new FormLayout("right:max(60dlu;pref), 3dlu, 50dlu:grow"); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.appendSeparator("Index Size"); builder.append("Document Collection:", this.DocSz); builder.append("Global Terms:", this.TermSz); builder.append("Files in Queue:", this.QueueSz); builder.appendSeparator("Index Threads"); builder.append(this.jsp, 3); FormLayout layout2 = new FormLayout("right:max(5dlu;pref), 3dlu, 105dlu:grow"); DefaultFormBuilder builder2 = new DefaultFormBuilder(layout2); for (int i = 0; i < this.thread.length; i++) { builder2.append(i + ":", this.thread[i]); builder2.append("", this.threadfile[i]); } this.threadPane.add(builder2.getPanel()); return builder.getPanel(); }
public void buildPanel(final DefaultMutableTreeNode controlsTree) { final FormLayout leftLayout = new FormLayout("max(80dlu;p):grow", ""); final DefaultFormBuilder leftBuilder = new DefaultFormBuilder(leftLayout); final CardLayout cardLayout = new VariableSizeCardLayout(); final JPanel rightStack = new JPanel(cardLayout); FormLayout rightLayout = null; DefaultFormBuilder rightBuilder = null; String lastTabName = null; initControls(controlsTree); final Iterator<IPropertyControl> iterator = controls.iterator(); // MaG: Controller.getCurrentController() .getOptionPanelController() .setCurrentPropertyControls(controls); while (iterator.hasNext()) { final IPropertyControl control = iterator.next(); if (control instanceof TabProperty) { final TabProperty newTab = (TabProperty) control; if (rightBuilder != null) { rightStack.add(rightBuilder.getPanel(), lastTabName); } rightLayout = new FormLayout(newTab.getDescription(), ""); rightBuilder = new DefaultFormBuilder(rightLayout); rightBuilder.setDefaultDialogBorder(); lastTabName = newTab.getLabel(); final JButton tabButton = new JButton(TextUtils.getOptionalText(lastTabName)); final ChangeTabAction changeTabAction = new ChangeTabAction(cardLayout, rightStack, lastTabName); tabButton.addActionListener(changeTabAction); registerTabButton(tabButton, lastTabName, changeTabAction); leftBuilder.append(tabButton); } else { control.layout(rightBuilder); } } rightStack.add(rightBuilder.getPanel(), lastTabName); if (selectedPanel != null && tabActionMap.containsKey(selectedPanel)) { (tabActionMap.get(selectedPanel)).actionPerformed(null); } final JScrollPane rightComponent = new JScrollPane(rightStack); UITools.setScrollbarIncrement(rightComponent); final JSplitPane centralPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftBuilder.getPanel(), rightComponent); topDialog.getContentPane().add(centralPanel, BorderLayout.CENTER); final JButton cancelButton = new JButton(); MenuBuilder.setLabelAndMnemonic(cancelButton, TextUtils.getRawText("cancel")); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent arg0) { closeWindow(); } }); final JButton okButton = new JButton(); MenuBuilder.setLabelAndMnemonic(okButton, TextUtils.getRawText("ok")); okButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent arg0) { if (validate()) { closeWindow(); feedback.writeProperties(getOptionProperties()); } } }); topDialog.getRootPane().setDefaultButton(okButton); topDialog .getContentPane() .add(ButtonBarFactory.buildOKCancelBar(cancelButton, okButton), BorderLayout.SOUTH); }
public TestCommandButtonSizes() { super("Command button sizes"); FormLayout fl = new FormLayout( "right:pref, 2dlu, center:pref, 2dlu, left:pref, 4dlu, right:pref, 2dlu, center:pref, 2dlu, left:pref"); DefaultFormBuilder builder = new DefaultFormBuilder(fl); builder.setDefaultDialogBorder(); ResizableIcon svgIcon = new font_x_generic(); svgIcon.setDimension(new Dimension(16, 16)); // Core Swing button with an icon and text builder.append("core"); JButton buttonCore1 = new JButton("s", svgIcon); JLabel sizeCore1 = new JLabel(); wireLabelToComponent(buttonCore1, sizeCore1); builder.append(buttonCore1, sizeCore1); // Flamingo MEDIUM action command button with an icon and text builder.append("command medium action"); JCommandButton commandButton1 = new JCommandButton("c", svgIcon); commandButton1.setDisplayState(CommandButtonDisplayState.MEDIUM); commandButton1.setFlat(false); JLabel sizeCommand1 = new JLabel(); wireLabelToComponent(commandButton1, sizeCommand1); builder.append(commandButton1, sizeCommand1); // Flamingo MEDIUM split command button with an icon and text builder.append("command medium split"); JCommandButton commandButton2 = new JCommandButton("c", svgIcon); commandButton2.setDisplayState(CommandButtonDisplayState.MEDIUM); commandButton2.setFlat(false); commandButton2.setCommandButtonKind(CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION); JLabel sizeCommand2 = new JLabel(); wireLabelToComponent(commandButton2, sizeCommand2); builder.append(commandButton2, sizeCommand2); // Flamingo MEDIUM command toggle button with an icon and text builder.append("command toggle medium"); JCommandToggleButton commandToggleButton1 = new JCommandToggleButton("ct", svgIcon); commandToggleButton1.setDisplayState(CommandButtonDisplayState.MEDIUM); commandToggleButton1.setFlat(false); JLabel sizeCommandToggle1 = new JLabel(); wireLabelToComponent(commandToggleButton1, sizeCommandToggle1); builder.append(commandToggleButton1, sizeCommandToggle1); // Core Swing button with an icon builder.append("core"); JButton buttonCore2 = new JButton(svgIcon); JLabel sizeCore2 = new JLabel(); wireLabelToComponent(buttonCore2, sizeCore2); builder.append(buttonCore2, sizeCore2); // Flamingo MEDIUM command toggle button with an icon builder.append("command toggle medium"); JCommandToggleButton commandToggleButton2 = new JCommandToggleButton(svgIcon); commandToggleButton2.setDisplayState(CommandButtonDisplayState.MEDIUM); commandToggleButton2.setFlat(false); JLabel sizeCommandToggle2 = new JLabel(); wireLabelToComponent(commandToggleButton2, sizeCommandToggle2); builder.append(commandToggleButton2, sizeCommandToggle2); // Flamingo MEDIUM action command button with an icon builder.append("command medium action"); JCommandButton commandButton3 = new JCommandButton(svgIcon); commandButton3.setDisplayState(CommandButtonDisplayState.MEDIUM); commandButton3.setFlat(false); JLabel sizeCommand3 = new JLabel(); wireLabelToComponent(commandButton3, sizeCommand3); builder.append(commandButton3, sizeCommand3); // Flamingo SMALL action command button with an icon and text builder.append("command small action"); JCommandButton commandButton4 = new JCommandButton("c", svgIcon); commandButton4.setDisplayState(CommandButtonDisplayState.SMALL); commandButton4.setFlat(false); JLabel sizeCommand4 = new JLabel(); wireLabelToComponent(commandButton4, sizeCommand4); builder.append(commandButton4, sizeCommand4); // Flamingo SMALL action command button with an icon and text builder.append("command small action, gap scale 0.5"); JCommandButton commandButton5 = new JCommandButton("c", svgIcon); commandButton5.setDisplayState(CommandButtonDisplayState.SMALL); commandButton5.setGapScaleFactor(0.5); commandButton5.setFlat(false); JLabel sizeCommand5 = new JLabel(); wireLabelToComponent(commandButton5, sizeCommand5); builder.append(commandButton5, sizeCommand5); this.add(builder.getPanel(), BorderLayout.CENTER); this.setSize(600, 300); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }