List of usage examples for javax.swing SwingConstants RIGHT
int RIGHT
To view the source code for javax.swing SwingConstants RIGHT.
Click Source Link
From source file:misc.ModalityDemo.java
/** * Create the GUI and show it. For thread safety, * this method is invoked from the//from ww w. j a va 2s . c o m * event-dispatching thread. */ private void createAndShowGUI() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gd.getDefaultConfiguration(); Insets ins = Toolkit.getDefaultToolkit().getScreenInsets(gc); int sw = gc.getBounds().width - ins.left - ins.right; int sh = gc.getBounds().height - ins.top - ins.bottom; // first document // frame f1 f1 = new JFrame("Book 1 (parent frame)"); f1.setBounds(32, 32, 300, 200); f1.addWindowListener(closeWindow); // create radio buttons rb11 = new JRadioButton("Biography", true); rb12 = new JRadioButton("Funny tale", false); rb13 = new JRadioButton("Sonnets", false); // place radio buttons into a single group ButtonGroup bg1 = new ButtonGroup(); bg1.add(rb11); bg1.add(rb12); bg1.add(rb13); JButton b1 = new JButton("OK"); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // get label of selected radiobutton String title = null; if (rb11.isSelected()) { title = rb11.getText(); } else if (rb12.isSelected()) { title = rb12.getText(); } else { title = rb13.getText(); } // prepend radio button label to dialogs' titles d2.setTitle(title + " (modeless dialog)"); d3.setTitle(title + " (document-modal dialog)"); d2.setVisible(true); } }); Container cp1 = f1.getContentPane(); // create three containers to improve layouting cp1.setLayout(new GridLayout(1, 3)); // an empty container Container cp11 = new Container(); // a container to layout components Container cp12 = new Container(); // an empty container Container cp13 = new Container(); // add a button into a separate panel JPanel p1 = new JPanel(); p1.setLayout(new FlowLayout()); p1.add(b1); // add radio buttons and the OK button one after another into a single column cp12.setLayout(new GridLayout(4, 1)); cp12.add(rb11); cp12.add(rb12); cp12.add(rb13); cp12.add(p1); // add three containers cp1.add(cp11); cp1.add(cp12); cp1.add(cp13); // dialog d2 d2 = new JDialog(f1); d2.setBounds(132, 132, 300, 200); d2.addWindowListener(closeWindow); JLabel l2 = new JLabel("Enter your name: "); l2.setHorizontalAlignment(SwingConstants.CENTER); tf2 = new JTextField(12); JButton b2 = new JButton("OK"); b2.setHorizontalAlignment(SwingConstants.CENTER); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //pass a name into the document modal dialog l3.setText("by " + tf2.getText()); d3.setVisible(true); } }); Container cp2 = d2.getContentPane(); // add label, text field and button one after another into a single column cp2.setLayout(new BorderLayout()); cp2.add(l2, BorderLayout.NORTH); cp2.add(tf2, BorderLayout.CENTER); JPanel p2 = new JPanel(); p2.setLayout(new FlowLayout()); p2.add(b2); cp2.add(p2, BorderLayout.SOUTH); // dialog d3 d3 = new JDialog(d2, "", Dialog.ModalityType.DOCUMENT_MODAL); d3.setBounds(232, 232, 300, 200); d3.addWindowListener(closeWindow); JTextArea ta3 = new JTextArea(); l3 = new JLabel(); l3.setHorizontalAlignment(SwingConstants.RIGHT); Container cp3 = d3.getContentPane(); cp3.setLayout(new BorderLayout()); cp3.add(new JScrollPane(ta3), BorderLayout.CENTER); JPanel p3 = new JPanel(); p3.setLayout(new FlowLayout(FlowLayout.RIGHT)); p3.add(l3); cp3.add(p3, BorderLayout.SOUTH); // second document // frame f4 f4 = new JFrame("Book 2 (parent frame)"); f4.setBounds(sw - 300 - 32, 32, 300, 200); f4.addWindowListener(closeWindow); // create radio buttons rb41 = new JRadioButton("Biography", true); rb42 = new JRadioButton("Funny tale", false); rb43 = new JRadioButton("Sonnets", false); // place radio buttons into a single group ButtonGroup bg4 = new ButtonGroup(); bg4.add(rb41); bg4.add(rb42); bg4.add(rb43); JButton b4 = new JButton("OK"); b4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // get label of selected radiobutton String title = null; if (rb41.isSelected()) { title = rb41.getText(); } else if (rb42.isSelected()) { title = rb42.getText(); } else { title = rb43.getText(); } // prepend radiobutton label to dialogs' titles d5.setTitle(title + " (modeless dialog)"); d6.setTitle(title + " (document-modal dialog)"); d5.setVisible(true); } }); Container cp4 = f4.getContentPane(); // create three containers to improve layouting cp4.setLayout(new GridLayout(1, 3)); Container cp41 = new Container(); Container cp42 = new Container(); Container cp43 = new Container(); // add the button into a separate panel JPanel p4 = new JPanel(); p4.setLayout(new FlowLayout()); p4.add(b4); // add radiobuttons and the OK button one after another into a single column cp42.setLayout(new GridLayout(4, 1)); cp42.add(rb41); cp42.add(rb42); cp42.add(rb43); cp42.add(p4); //add three containers cp4.add(cp41); cp4.add(cp42); cp4.add(cp43); // dialog d5 d5 = new JDialog(f4); d5.setBounds(sw - 400 - 32, 132, 300, 200); d5.addWindowListener(closeWindow); JLabel l5 = new JLabel("Enter your name: "); l5.setHorizontalAlignment(SwingConstants.CENTER); tf5 = new JTextField(12); tf5.setHorizontalAlignment(SwingConstants.CENTER); JButton b5 = new JButton("OK"); b5.setHorizontalAlignment(SwingConstants.CENTER); b5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //pass a name into the document modal dialog l6.setText("by " + tf5.getText()); d6.setVisible(true); } }); Container cp5 = d5.getContentPane(); // add label, text field and button one after another into a single column cp5.setLayout(new BorderLayout()); cp5.add(l5, BorderLayout.NORTH); cp5.add(tf5, BorderLayout.CENTER); JPanel p5 = new JPanel(); p5.setLayout(new FlowLayout()); p5.add(b5); cp5.add(p5, BorderLayout.SOUTH); // dialog d6 d6 = new JDialog(d5, "", Dialog.ModalityType.DOCUMENT_MODAL); d6.setBounds(sw - 500 - 32, 232, 300, 200); d6.addWindowListener(closeWindow); JTextArea ta6 = new JTextArea(); l6 = new JLabel(); l6.setHorizontalAlignment(SwingConstants.RIGHT); Container cp6 = d6.getContentPane(); cp6.setLayout(new BorderLayout()); cp6.add(new JScrollPane(ta6), BorderLayout.CENTER); JPanel p6 = new JPanel(); p6.setLayout(new FlowLayout(FlowLayout.RIGHT)); p6.add(l6); cp6.add(p6, BorderLayout.SOUTH); // third document // frame f7 f7 = new JFrame("Classics (excluded frame)"); f7.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE); f7.setBounds(32, sh - 200 - 32, 300, 200); f7.addWindowListener(closeWindow); JLabel l7 = new JLabel("Famous writers: "); l7.setHorizontalAlignment(SwingConstants.CENTER); // create radio buttons rb71 = new JRadioButton("Burns", true); rb72 = new JRadioButton("Dickens", false); rb73 = new JRadioButton("Twain", false); // place radio buttons into a single group ButtonGroup bg7 = new ButtonGroup(); bg7.add(rb71); bg7.add(rb72); bg7.add(rb73); Container cp7 = f7.getContentPane(); // create three containers to improve layouting cp7.setLayout(new GridLayout(1, 3)); Container cp71 = new Container(); Container cp72 = new Container(); Container cp73 = new Container(); // add the label into a separate panel JPanel p7 = new JPanel(); p7.setLayout(new FlowLayout()); p7.add(l7); // add a label and radio buttons one after another into a single column cp72.setLayout(new GridLayout(4, 1)); cp72.add(p7); cp72.add(rb71); cp72.add(rb72); cp72.add(rb73); // add three containers cp7.add(cp71); cp7.add(cp72); cp7.add(cp73); // fourth document // frame f8 f8 = new JFrame("Feedback (parent frame)"); f8.setBounds(sw - 300 - 32, sh - 200 - 32, 300, 200); f8.addWindowListener(closeWindow); JButton b8 = new JButton("Rate yourself"); b8.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showConfirmDialog(null, "I really like my book", "Question (application-modal dialog)", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); } }); Container cp8 = f8.getContentPane(); cp8.setLayout(new FlowLayout(FlowLayout.CENTER, 8, 8)); cp8.add(b8); }
From source file:edu.ku.brc.specify.plugins.latlon.DDDDPanel.java
/** * Creates the UI for the panel./*from w ww .ja va 2 s.com*/ * @param colDef the JGoodies column definition * @param latCols the number of columns for the latitude control * @param lonCols the number of columns for the longitude control * @param cbxIndex the column index of the combobox * @return return the builder */ protected PanelBuilder createUI(final String colDef, final int latCols, final int lonCols, final int cbxIndex, final boolean asDDIntegers) { latitudeDD = asDDIntegers ? createTextField(Integer.class, latCols, 0, 90, latTFs) : createTextField(Double.class, latCols, 0.0, 90.0, latTFs); longitudeDD = asDDIntegers ? createTextField(Integer.class, lonCols, 0, 180, lonTFs) : createTextField(Double.class, lonCols, 0.0, 180.0, lonTFs); textFields.addAll(latTFs); textFields.addAll(lonTFs); PanelBuilder builder = new PanelBuilder(new FormLayout(colDef, "p, 1px, p, c:p:g")); CellConstraints cc = new CellConstraints(); latitudeDir = createDirComboxbox(true); longitudeDir = createDirComboxbox(false); JComponent latDir; JComponent lonDir; if (isViewMode) { latitudeDirTxt = new JTextField(2); longitudeDirTxt = new JTextField(2); setControlSize(latitudeDirTxt); setControlSize(longitudeDirTxt); ViewFactory.changeTextFieldUIForDisplay(latitudeDirTxt, false); ViewFactory.changeTextFieldUIForDisplay(longitudeDirTxt, false); latDir = latitudeDirTxt; lonDir = longitudeDirTxt; } else { latDir = latitudeDir; lonDir = longitudeDir; } builder.add(latLabel = createI18NFormLabel("Latitude", SwingConstants.RIGHT), cc.xy(1, 1)); builder.add(latitudeDD, cc.xy(3, 1)); builder.add(latDir, cc.xy(cbxIndex, 1)); builder.add(lonLabel = createI18NFormLabel("Longitude", SwingConstants.RIGHT), cc.xy(1, 3)); builder.add(longitudeDD, cc.xy(3, 3)); builder.add(lonDir, cc.xy(cbxIndex, 3)); builder.setBorder(BorderFactory.createEmptyBorder(4, 2, 0, 2)); PanelBuilder pb = new PanelBuilder(new FormLayout(colDef, "p, 1px, p, p"), this); PanelBuilder txtPanelPB = new PanelBuilder(new FormLayout("5px,p,5px,p,2px,p", "p, 4px, p")); latitudeTF = new JTextField(15); longitudeTF = new JTextField(15); if (!isViewMode) { Color bg = getBackground(); txtPanelPB.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xywh(1, 1, 1, 3)); txtPanelPB.add(latitudeTF, cc.xy(4, 1)); txtPanelPB.add(createI18NLabel("SOURCE"), cc.xy(6, 1)); txtPanelPB.add(longitudeTF, cc.xy(4, 3)); txtPanelPB.add(createI18NLabel("SOURCE"), cc.xy(6, 3)); txtPanelPB.setBorder(BorderFactory.createEmptyBorder(4, 2, 0, 2)); } latitudeTF.setEditable(false); longitudeTF.setEditable(false); pb.add(builder.getPanel(), cc.xy(1, 1)); pb.add(txtPanelPB.getPanel(), cc.xy(3, 1)); textFields.addAll(latTFs); textFields.addAll(lonTFs); return builder; }
From source file:com.simplexrepaginator.RepaginateFrame.java
protected JButton createInputButton() { JButton b = new JButton("Click or drag to set input files", PDF_1342); b.setHorizontalTextPosition(SwingConstants.RIGHT); b.setIconTextGap(25);/*from w ww . j a v a 2 s . c om*/ b.setTransferHandler(new InputButtonTransferHandler()); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(true); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); if (chooser.showOpenDialog(RepaginateFrame.this) != JFileChooser.APPROVE_OPTION) return; setInput(Arrays.asList(chooser.getSelectedFiles())); if (JOptionPane.showConfirmDialog(RepaginateFrame.this, "Use input paths as output paths?", "Use Input As Output?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { setOutput(new ArrayList<File>(repaginator.getInputFiles())); } } }); return b; }
From source file:net.nikr.eve.jeveasset.gui.tabs.tracker.TrackerTab.java
public TrackerTab(Program program) { super(program, TabsTracker.get().title(), Images.TOOL_TRACKER.getIcon(), true); filterDialog = new TrackerFilterDialog(program); jPopupMenu = new JPopupMenu(); jPopupMenu.addPopupMenuListener(listener); JMenuItem jMenuItem;//from w ww . j a v a2 s. co m jMenuItem = new JMenuItem(TabsTracker.get().edit(), Images.EDIT_EDIT.getIcon()); jMenuItem.setActionCommand(TrackerAction.EDIT.name()); jMenuItem.addActionListener(listener); jPopupMenu.add(jMenuItem); jMenuItem = new JMenuItem(TabsTracker.get().delete(), Images.EDIT_DELETE.getIcon()); jMenuItem.setActionCommand(TrackerAction.DELETE.name()); jMenuItem.addActionListener(listener); jPopupMenu.add(jMenuItem); JMenuInfo.createDefault(jPopupMenu); jIskValue = new JMenuItem(); jIskValue.setEnabled(false); jIskValue.setForeground(Color.BLACK); jIskValue.setHorizontalAlignment(SwingConstants.RIGHT); jIskValue.setDisabledIcon(Images.TOOL_VALUES.getIcon()); jPopupMenu.add(jIskValue); jDateValue = new JMenuItem(); jDateValue.setEnabled(false); jDateValue.setForeground(Color.BLACK); jDateValue.setHorizontalAlignment(SwingConstants.RIGHT); jPopupMenu.add(jDateValue); jEditDialog = new JTrackerEditDialog(program); jSelectionDialog = new JSelectionDialog(program); JSeparator jDateSeparator = new JSeparator(); jQuickDate = new JComboBox<QuickDate>(QuickDate.values()); jQuickDate.setActionCommand(TrackerAction.QUICK_DATE.name()); jQuickDate.addActionListener(listener); JLabel jFromLabel = new JLabel(TabsTracker.get().from()); jFrom = createDateChooser(); JLabel jToLabel = new JLabel(TabsTracker.get().to()); jTo = createDateChooser(); jAll = new JCheckBox(General.get().all()); jAll.setSelected(true); jAll.setActionCommand(TrackerAction.ALL.name()); jAll.addActionListener(listener); jAll.setFont(new Font(jAll.getFont().getName(), Font.ITALIC, jAll.getFont().getSize())); jTotal = new JCheckBox(TabsTracker.get().total()); jTotal.setSelected(true); jTotal.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jTotal.addActionListener(listener); jWalletBalance = new JCheckBox(TabsTracker.get().walletBalance()); jWalletBalance.setSelected(true); jWalletBalance.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jWalletBalance.addActionListener(listener); jWalletBalanceFilters = new JButton(Images.LOC_INCLUDE.getIcon()); jWalletBalanceFilters.setActionCommand(TrackerAction.FILTER_WALLET_BALANCE.name()); jWalletBalanceFilters.addActionListener(listener); jAssets = new JCheckBox(TabsTracker.get().assets()); jAssets.setSelected(true); jAssets.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jAssets.addActionListener(listener); jAssetsFilters = new JButton(Images.LOC_INCLUDE.getIcon()); jAssetsFilters.setActionCommand(TrackerAction.FILTER_ASSETS.name()); jAssetsFilters.addActionListener(listener); jSellOrders = new JCheckBox(TabsTracker.get().sellOrders()); jSellOrders.setSelected(true); jSellOrders.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jSellOrders.addActionListener(listener); jEscrows = new JCheckBox(TabsTracker.get().escrows()); jEscrows.setSelected(true); jEscrows.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jEscrows.addActionListener(listener); jEscrowsToCover = new JCheckBox(TabsTracker.get().escrowsToCover()); jEscrowsToCover.setSelected(true); jEscrowsToCover.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jEscrowsToCover.addActionListener(listener); jManufacturing = new JCheckBox(TabsTracker.get().manufacturing()); jManufacturing.setSelected(true); jManufacturing.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jManufacturing.addActionListener(listener); jContractCollateral = new JCheckBox(TabsTracker.get().contractCollateral()); jContractCollateral.setSelected(true); jContractCollateral.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jContractCollateral.addActionListener(listener); jContractValue = new JCheckBox(TabsTracker.get().contractValue()); jContractValue.setSelected(true); jContractValue.setActionCommand(TrackerAction.UPDATE_SHOWN.name()); jContractValue.addActionListener(listener); JSeparator jOwnersSeparator = new JSeparator(); jAllProfiles = new JCheckBox(TabsTracker.get().allProfiles()); jAllProfiles.setActionCommand(TrackerAction.PROFILE.name()); jAllProfiles.addActionListener(listener); jOwners = new JMultiSelectionList<String>(); jOwners.getSelectionModel().addListSelectionListener(listener); JScrollPane jOwnersScroll = new JScrollPane(jOwners); JLabel jHelp = new JLabel(TabsTracker.get().help()); jHelp.setIcon(Images.MISC_HELP.getIcon()); JLabel jNoFilter = new JLabel(TabsTracker.get().helpLegacyData()); jNoFilter.setIcon(new ShapeIcon(NO_FILTER)); JLabel jFilter = new JLabel(TabsTracker.get().helpNewData()); jFilter.setIcon(new ShapeIcon(FILTER_AND_DEFAULT)); JDropDownButton jSettings = new JDropDownButton(Images.DIALOG_SETTINGS.getIcon()); jIncludeZero = new JCheckBoxMenuItem(TabsTracker.get().includeZero()); jIncludeZero.setSelected(true); jIncludeZero.setActionCommand(TrackerAction.INCLUDE_ZERO.name()); jIncludeZero.addActionListener(listener); jSettings.add(jIncludeZero); DateAxis domainAxis = new DateAxis(); domainAxis.setDateFormatOverride(dateFormat); domainAxis.setVerticalTickLabels(true); domainAxis.setAutoTickUnitSelection(true); domainAxis.setAutoRange(true); domainAxis.setTickLabelFont(jFromLabel.getFont()); NumberAxis rangeAxis = new NumberAxis(); rangeAxis.setAutoRange(true); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); rangeAxis.setTickLabelFont(jFromLabel.getFont()); //XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, new XYLineAndShapeRenderer(true, true)); render = new MyRender(); XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, render); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.getRenderer() .setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: {2} ({1})", dateFormat, iskFormat)); plot.setDomainCrosshairLockedOnData(true); plot.setDomainCrosshairStroke(new BasicStroke(1)); plot.setDomainCrosshairPaint(Color.BLACK); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairLockedOnData(true); plot.setRangeCrosshairVisible(false); jNextChart = new JFreeChart(plot); jNextChart.setAntiAlias(true); jNextChart.setBackgroundPaint(jPanel.getBackground()); jNextChart.addProgressListener(null); jNextChart.getLegend().setItemFont(jFrom.getFont()); jChartPanel = new ChartPanel(jNextChart); jChartPanel.addMouseListener(listener); jChartPanel.setDomainZoomable(false); jChartPanel.setRangeZoomable(false); jChartPanel.setPopupMenu(null); jChartPanel.addChartMouseListener(listener); jChartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); jChartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); jChartPanel.setMinimumDrawWidth(10); jChartPanel.setMinimumDrawHeight(10); int AssetsGapWidth = PANEL_WIDTH - jAssets.getPreferredSize().width - jAssetsFilters.getPreferredSize().width; if (AssetsGapWidth < 0) { AssetsGapWidth = 0; } int WalletGapWidth = PANEL_WIDTH - jWalletBalance.getPreferredSize().width - jWalletBalanceFilters.getPreferredSize().width; if (WalletGapWidth < 0) { WalletGapWidth = 0; } layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup().addComponent(jHelp).addGap(20).addComponent(jNoFilter) .addGap(20).addComponent(jFilter).addGap(20, 20, Integer.MAX_VALUE).addComponent(jSettings) .addGap(6)) .addComponent(jChartPanel)).addGroup( layout.createParallelGroup().addComponent(jQuickDate, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(jFromLabel, LABEL_WIDTH, LABEL_WIDTH, LABEL_WIDTH) .addComponent(jToLabel, LABEL_WIDTH, LABEL_WIDTH, LABEL_WIDTH)) .addGap(0) .addGroup(layout.createParallelGroup() .addComponent(jFrom, PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH) .addComponent(jTo, PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH))) .addComponent(jDateSeparator, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jAll, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jTotal, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addGroup(layout.createSequentialGroup().addComponent(jWalletBalance) .addGap(0, 0, WalletGapWidth).addComponent(jWalletBalanceFilters)) .addGroup(layout.createSequentialGroup().addComponent(jAssets) .addGap(0, 0, AssetsGapWidth).addComponent(jAssetsFilters)) .addComponent(jSellOrders, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jEscrows, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jEscrowsToCover, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jManufacturing, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jContractCollateral, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jContractValue, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jOwnersSeparator, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jAllProfiles, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH) .addComponent(jOwnersScroll, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH))); layout.setVerticalGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup() .addComponent(jHelp, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jNoFilter, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jFilter, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jSettings, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addComponent(jChartPanel)) .addGroup(layout.createSequentialGroup() .addComponent(jQuickDate, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addGroup(layout.createParallelGroup() .addComponent(jFromLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jFrom, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addGroup(layout.createParallelGroup() .addComponent(jToLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jTo, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addComponent(jDateSeparator, 3, 3, 3) .addComponent(jAll, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jTotal, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addGroup(layout.createParallelGroup() .addComponent(jWalletBalance, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jWalletBalanceFilters, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addGroup(layout.createParallelGroup() .addComponent(jAssets, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jAssetsFilters, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())) .addComponent(jSellOrders, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jEscrows, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jEscrowsToCover, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jManufacturing, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jContractCollateral, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jContractValue, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jOwnersSeparator, 3, 3, 3) .addComponent(jAllProfiles, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight()) .addComponent(jOwnersScroll, 70, 70, Integer.MAX_VALUE))); }
From source file:drusy.ui.panels.InternetStatePanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Kvin Renella headerPanel = new JPanel(); label1 = new JLabel(); mainPanel = new JPanel(); ipv4TitleLabel = new JLabel(); ipv4ContentLabel = new JTextField(); connectionStateTitleLabel = new JLabel(); connectionStateContentLabel = new JTextField(); downloadContentLabel = new JTextField(); downloadTitleLabel = new JLabel(); maxUploadTitleLabel = new JLabel(); maxUploadContentLabel = new JTextField(); maxDownloadTitleLabel = new JLabel(); maxDownloadContentLabel = new JTextField(); uploadTitleLabel = new JLabel(); uploadContentLabel = new JTextField(); ipv6ContentLabel = new JTextField(); ipv6TitleLabel = new JLabel(); uptimeContentLabel = new JTextField(); uptimeTitleLabel = new JLabel(); //======== this ======== setMinimumSize(new Dimension(100, 71)); setLayout(new BorderLayout()); //======== headerPanel ======== {/*from w ww . ja v a 2 s .co m*/ headerPanel.setLayout(new BorderLayout()); //---- label1 ---- label1.setText("This panel shows you an overview of the internet connection"); label1.setHorizontalAlignment(SwingConstants.CENTER); headerPanel.add(label1, BorderLayout.CENTER); } add(headerPanel, BorderLayout.NORTH); //======== mainPanel ======== { mainPanel.setOpaque(false); mainPanel.setMinimumSize(new Dimension(100, 100)); //---- ipv4TitleLabel ---- ipv4TitleLabel.setText("IP v4 :"); ipv4TitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- ipv4ContentLabel ---- ipv4ContentLabel.setEditable(false); ipv4ContentLabel.setText("192.168.0.1"); ipv4ContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- connectionStateTitleLabel ---- connectionStateTitleLabel.setText("Connection State :"); connectionStateTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- connectionStateContentLabel ---- connectionStateContentLabel.setEditable(false); connectionStateContentLabel.setText("up"); connectionStateContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- downloadContentLabel ---- downloadContentLabel.setEditable(false); downloadContentLabel.setText("- ko/s"); downloadContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- downloadTitleLabel ---- downloadTitleLabel.setText("Download Bandwidth :"); downloadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- maxUploadTitleLabel ---- maxUploadTitleLabel.setText("Max Upload Bandwidth :"); maxUploadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- maxUploadContentLabel ---- maxUploadContentLabel.setEditable(false); maxUploadContentLabel.setText("- ko/s"); maxUploadContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- maxDownloadTitleLabel ---- maxDownloadTitleLabel.setText("Max Download Bandwidth :"); maxDownloadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- maxDownloadContentLabel ---- maxDownloadContentLabel.setEditable(false); maxDownloadContentLabel.setText("- ko/s"); maxDownloadContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- uploadTitleLabel ---- uploadTitleLabel.setText("Upload Bandwidth :"); uploadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- uploadContentLabel ---- uploadContentLabel.setEditable(false); uploadContentLabel.setText("- ko/s"); uploadContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- ipv6ContentLabel ---- ipv6ContentLabel.setEditable(false); ipv6ContentLabel.setText("::1:"); ipv6ContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- ipv6TitleLabel ---- ipv6TitleLabel.setText("IP v6 :"); ipv6TitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- uptimeContentLabel ---- uptimeContentLabel.setEditable(false); uptimeContentLabel.setText("0 min"); uptimeContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- uptimeTitleLabel ---- uptimeTitleLabel.setText("Uptime :"); uptimeTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout.createParallelGroup() .addGroup(mainPanelLayout.createSequentialGroup().addContainerGap() .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(connectionStateTitleLabel).addComponent(downloadTitleLabel) .addComponent(ipv4TitleLabel).addComponent(maxUploadTitleLabel) .addComponent(maxDownloadTitleLabel).addComponent(uploadTitleLabel) .addComponent(ipv6TitleLabel).addComponent(uptimeTitleLabel)) .addGap(10, 10, 10) .addGroup(mainPanelLayout.createParallelGroup() .addComponent(ipv4ContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(connectionStateContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(downloadContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(maxUploadContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(maxDownloadContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(uploadContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(ipv6ContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(uptimeContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)) .addContainerGap())); mainPanelLayout.setVerticalGroup(mainPanelLayout.createParallelGroup() .addGroup(mainPanelLayout.createSequentialGroup().addGap(20, 20, 20) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ipv4TitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(ipv4ContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ipv6TitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(ipv6ContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(connectionStateTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(connectionStateContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(uploadTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(uploadContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(maxUploadTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(maxUploadContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(downloadTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(downloadContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(maxDownloadTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(maxDownloadContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(uptimeTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(uptimeContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); } add(mainPanel, BorderLayout.CENTER); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:edu.ku.brc.specify.conversion.CustomDBConverterPanel.java
/** * Creates a line in the form.//from w w w . j a v a 2 s .c o m * * @param label JLabel text * @param comp the component to be added * @param pb the PanelBuilder to use * @param cc the CellConstratins to use * @param y the 'y' coordinate in the layout of the form * @return return an incremented by 2 'y' position */ protected int addLine(final String label, final JComponent comp, final PanelBuilder pb, final CellConstraints cc, final int x, final int y) { int yy = y; pb.add(createLabel(label != null ? getResourceString(label) + ":" : " ", SwingConstants.RIGHT), cc.xy(x, yy)); pb.add(comp, cc.xy(x + 2, yy)); yy += 2; return yy; }
From source file:com.pos.spatobiz.app.view.karyawan.UbahKaryawan.java
/** This method is called from within the constructor to * initialize the form./*from www . jav a 2 s . co m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jeniskelamin = new ButtonGroup(); labelKode = new WhiteLabel(); labelNama = new WhiteLabel(); labelTanggalLahir = new WhiteLabel(); labelAlamat = new WhiteLabel(); textKode = new TextBoxTransfer(); textNama = new TextBoxTransfer(); textTanggalLahir = new DateBox(); textAlamat = new WhiteTextArea(); errorKode = new RedLabel(); errorNama = new RedLabel(); errorTanggalLahir = new RedLabel(); errorAlamat = new RedLabel(); textTelepon = new TextBoxTransfer(); labelTelepon = new WhiteLabel(); labelEmail = new WhiteLabel(); labelJenisKelamin = new WhiteLabel(); labelPhoto = new WhiteLabel(); textEmail = new TextBoxTransfer(); radioPria = new JRadioButton(); radioWanita = new JRadioButton(); errorTelepon = new RedLabel(); errorEmail = new RedLabel(); imageChooser = new ImageChooser(); buttonBatal = new Button(); buttonUbah = new Button(); buttonCari = new Button(); setBackground(new Color(0, 0, 0)); labelKode.setHorizontalAlignment(SwingConstants.RIGHT); labelKode.setText("Kode :"); labelNama.setHorizontalAlignment(SwingConstants.RIGHT); labelNama.setText("Nama :"); labelTanggalLahir.setHorizontalAlignment(SwingConstants.RIGHT); labelTanggalLahir.setText("Tanggal Lahir :"); labelAlamat.setHorizontalAlignment(SwingConstants.RIGHT); labelAlamat.setText("Alamat :"); textTanggalLahir.setFormatterFactory( new DefaultFormatterFactory(new DateFormatter(DateFormat.getDateInstance(DateFormat.LONG)))); textTanggalLahir.setPreferredSize(new Dimension(120, 24)); textTanggalLahir.setValue(new Date()); errorKode.setText("error kode"); errorNama.setText("error nama"); errorTanggalLahir.setText("error tanggal lahir"); errorAlamat.setText("error alamat"); labelTelepon.setHorizontalAlignment(SwingConstants.RIGHT); labelTelepon.setText("Telepon :"); labelEmail.setHorizontalAlignment(SwingConstants.RIGHT); labelEmail.setText("Email :"); labelJenisKelamin.setHorizontalAlignment(SwingConstants.RIGHT); labelJenisKelamin.setText("Jenis Kelamin :"); labelPhoto.setHorizontalAlignment(SwingConstants.RIGHT); labelPhoto.setText("Photo :"); jeniskelamin.add(radioPria); radioPria.setFont(new Font("Tahoma", 1, 11)); radioPria.setForeground(new Color(255, 255, 255)); radioPria.setSelected(true); radioPria.setText("Pria"); radioPria.setOpaque(false); jeniskelamin.add(radioWanita); radioWanita.setFont(new Font("Tahoma", 1, 11)); radioWanita.setForeground(new Color(255, 255, 255)); radioWanita.setText("Wanita"); radioWanita.setOpaque(false); errorTelepon.setText("error telepon"); errorEmail.setText("error email"); buttonBatal.setMnemonic('B'); buttonBatal.setText("Batal"); buttonUbah.setMnemonic('U'); buttonUbah.setText("Ubah"); buttonCari.setText("Cari"); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelPhoto, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelJenisKelamin, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelEmail, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelTelepon, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelTanggalLahir, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelKode, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.TRAILING) .addComponent(textAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addComponent(textNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addComponent(textTanggalLahir, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addComponent(textTelepon, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addGroup(Alignment.LEADING, layout.createSequentialGroup().addComponent(radioPria) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(radioWanita)) .addComponent(imageChooser, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE) .addComponent(textEmail, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(textKode, GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(buttonCari, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGap(4, 4, 4) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(errorKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup(Alignment.TRAILING, layout.createSequentialGroup() .addComponent(buttonUbah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonCari, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(labelAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textAlamat, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addComponent(errorAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(textTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(labelTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelJenisKelamin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(radioPria).addComponent(radioWanita)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(labelPhoto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(imageChooser, GroupLayout.PREFERRED_SIZE, 189, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonUbah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); }
From source file:MainProgram.MainProgram.java
private void initComponents() throws InterruptedException { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents welcomeMessage = new JLabel(); welcomeMessage2 = new JLabel(); pennIDLabel = new JLabel(); pennIDTextField = new JTextField(); pennPassLabel = new JLabel(); pennPassField = new JPasswordField(); emailLabel = new JLabel(); emailTextField = new JTextField(); emailDomainLabel = new JLabel(); emailPassLabel = new JLabel(); emailPassField = new JPasswordField(); semesterLabel = new JLabel(); semesterComboBox = new JComboBox(semestersString); credentials = new JLabel(); dropLabel = new JLabel(); dropCheckBox = new JCheckBox(); button = new JButton(); stopWatchLabel = new JLabel(); checkMail = false;/*from www. jav a2 s .c om*/ testConnection = false; mailCheckTimeInitializer(); StopWatchInitializer(); try { setUIFont(new javax.swing.plaf.FontUIResource("Segoe UI", Font.ROMAN_BASELINE, 12)); } catch (Exception e) { e.printStackTrace(MainProgram.errorLog); } String lcOSName = System.getProperty("os.name").toLowerCase(); boolean IS_MAC = lcOSName.startsWith("mac os x"); //======== this ======== setLayout(new GridBagLayout()); ((GridBagLayout) getLayout()).columnWidths = new int[] { 81, 5, 119, 5, 0, 0 }; if (!IS_MAC) { ((GridBagLayout) getLayout()).rowHeights = new int[] { 17, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 0, 0, 0 }; } ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.fill = GridBagConstraints.HORIZONTAL; //---- welcomeMessage ---- welcomeMessage.setText("Course Registration"); welcomeMessage.setHorizontalAlignment(SwingConstants.CENTER); add(welcomeMessage, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- welcomeMessage2 ---- welcomeMessage2.setText("for Penn State (BETA)"); welcomeMessage2.setHorizontalAlignment(SwingConstants.CENTER); add(welcomeMessage2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennIDLabel ---- pennIDLabel.setText("Penn State ID: "); pennIDLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(pennIDLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennIDTextField ---- pennIDTextField.setText("xxx123"); add(pennIDTextField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennPassLabel ---- pennPassLabel.setText("Penn State Password: "); pennPassLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(pennPassLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(pennPassField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailLabel ---- emailLabel.setText("Email: "); emailLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(emailLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailTextField ---- emailTextField.setText("myEmail"); add(emailTextField, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailDomainLabel ---- emailDomainLabel.setText("@mail.com"); add(emailDomainLabel, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailPassLabel ---- emailPassLabel.setText("Email Password: "); emailPassLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(emailPassLabel, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(emailPassField, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- Semester label ---- semesterLabel.setText("Semester/Drop Option: "); semesterLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(semesterLabel, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- Semester ComboBox ---- add(semesterComboBox, new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- Drop CheckBox ---- add(dropCheckBox, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- button ---- button.setText("Start"); add(button, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- stopWatchLabel ---- stopWatchLabel.setText(" " + stopWatchSplitting[0]); stopWatchLabel.setHorizontalAlignment(SwingConstants.LEFT); add(stopWatchLabel, new GridBagConstraints(2, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- label11 ---- credentials.setText(" Created by Daniyar Yeralin"); credentials.setForeground(Color.gray); credentials.setHorizontalAlignment(SwingConstants.RIGHT); credentials.setFont(new Font("Cambria", Font.ITALIC, 12)); add(credentials, new GridBagConstraints(2, 17, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); /*button.registerKeyboardAction(button.getActionForKeyStroke( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED); button.registerKeyboardAction(button.getActionForKeyStroke( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), JComponent.WHEN_FOCUSED);*/ StartButtonHandler buttonListener = new StartButtonHandler(); button.addActionListener(buttonListener); }
From source file:edu.ku.brc.stats.StatGroupTable.java
/** * Constructor with the localized name of the Group * @param name name of the group (already been localized) * @param useSeparator use non-border separator titles *//*from w w w . j a v a 2s . c o m*/ public StatGroupTable(final String name, final String[] columnNames, final boolean useSeparator, final int numRows) { this.name = name; this.useSeparator = useSeparator; this.skinItem = SkinsMgr.getSkinItem("StatGroup"); if (progressIcon == null) { progressIcon = IconManager.getIcon("Progress", IconManager.IconSize.Std16); } setLayout(new BorderLayout()); setBackground(Color.WHITE); model = new StatGroupTableModel(this, columnNames); //table = numRows > SCROLLPANE_THRESOLD ? (new SortableJTable(new SortableTableModel(model))) : (new JTable(model)); if (numRows > SCROLLPANE_THRESOLD) { table = new SortableJTable(new SortableTableModel(model)) { protected void configureEnclosingScrollPane() { Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } // scrollPane.setColumnHeaderView(getTableHeader()); //scrollPane.getViewport().setBackingStoreEnabled(true); scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } } } }; } else { table = new JTable(model) { protected void configureEnclosingScrollPane() { Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } // scrollPane.setColumnHeaderView(getTableHeader()); //scrollPane.getViewport().setBackingStoreEnabled(true); scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } } } }; } table.setShowVerticalLines(false); table.setShowHorizontalLines(false); if (SkinsMgr.shouldBeOpaque(skinItem)) { table.setOpaque(false); setOpaque(false); } else { table.setOpaque(true); setOpaque(true); } table.addMouseMotionListener(new TableMouseMotion()); table.addMouseListener(new LinkListener()); if (table.getColumnModel().getColumnCount() == 1) { table.getColumnModel().getColumn(0) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.CENTER, 1)); } else { table.getColumnModel().getColumn(0) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.LEFT, 2)); table.getColumnModel().getColumn(1) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.RIGHT, 2)); } //table.setRowSelectionAllowed(true); if (numRows > SCROLLPANE_THRESOLD) { scrollPane = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); if (table instanceof SortableJTable) { ((SortableJTable) table).installColumnHeaderListeners(); } scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(BorderFactory.createEmptyBorder()); //scrollPane.getViewport().setBorder(BorderFactory.createEmptyBorder()); } if (useSeparator) { setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); CellConstraints cc = new CellConstraints(); if (StringUtils.isNotEmpty(name)) { builder.addSeparator(name, cc.xy(1, 1)); } builder.add(scrollPane != null ? scrollPane : table, cc.xy(1, 2)); builder.getPanel().setOpaque(false); add(builder.getPanel()); } else { setBorder(BorderFactory.createEmptyBorder(15, 2, 2, 2)); setBorder(BorderFactory.createCompoundBorder(new CurvedBorder(new Color(160, 160, 160)), getBorder())); add(scrollPane != null ? scrollPane : table, BorderLayout.CENTER); } }
From source file:edu.ku.brc.specify.config.init.DatabasePanel.java
/** * Creates a dialog for entering database name and selecting the appropriate driver. *///from w ww. jav a2 s .c o m @SuppressWarnings("unchecked") public DatabasePanel(final JButton nextBtn, final JButton prevBtn, final String helpContext, final boolean doSetDefaultValues) { super("DATABASE", helpContext, nextBtn, prevBtn); this.doSetDefaultValues = doSetDefaultValues; int t = 0; // for (int p : SKIP_DB_CREATE_PERMS) { // t |= p; // } // PERM_SKIP_DB_CREATE = t; // // t = 0; for (int p : CREATE_DB_PERMS) { t |= p; } PERM_CREATE_DB = t; PERM_SKIP_DB_CREATE = t; //see comments in createSkipDBCreatePerms() createSkipDBCreatePerms(); createCreateDBPerms(); String header = getResourceString("ENTER_DB_INFO") + ":"; CellConstraints cc = new CellConstraints(); String rowDef = "p,2px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", 7) + ",10px,p,10px,p,4px,p,4px,p"; PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,p:g", rowDef), this); int row = 1; builder.add(createLabel(header, SwingConstants.CENTER), cc.xywh(1, row, 3, 1)); row += 2; usernameTxt = createField(builder, "IT_USERNAME", true, row); row += 2; passwordTxt = createField(builder, "IT_PASSWORD", true, row, true, null); row += 2; dbNameTxt = createField(builder, "DB_NAME", true, row); row += 2; hostNameTxt = createField(builder, "HOST_NAME", true, row); row += 2; driverList = DatabaseDriverInfo.getDriversList(); drivers = (JComboBox<DatabaseDriverInfo>) createComboBox(driverList); // MySQL as the default drivers.setSelectedItem(DatabaseDriverInfo.getDriver("MySQL")); JLabel lbl = createI18NFormLabel("DRIVER", SwingConstants.RIGHT); lbl.setFont(bold); builder.add(lbl, cc.xy(1, row)); builder.add(drivers, cc.xy(3, row)); row += 2; builder.add(createLabel(" "), cc.xy(1, row)); // spacer row += 2; isStructureOnly = createCheckBox(builder, "CONVUPLD_CHKBX", row); isStructureOnly.setToolTipText(getResourceString("CONVUPLD_CHKBX_TT")); isStructureOnly.setVisible(!UIRegistry.isMobile() && !UIRegistry.isEmbedded()); row += 2; label = UIHelper.createLabel("", SwingConstants.CENTER); createDBBtn = UIHelper.createI18NButton("CREATE_DB"); PanelBuilder tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(createDBBtn, cc.xy(2, 1)); PanelBuilder panelPB = new PanelBuilder(new FormLayout("f:p:g", "20px,p,2px,p,8px,p")); panelPB.add(tstPB.getPanel(), cc.xy(1, 2)); panelPB.add(getProgressBar(), cc.xy(1, 4)); panelPB.add(label, cc.xy(1, 6)); builder.add(panelPB.getPanel(), cc.xy(3, row)); row += 2; // Advance part of pane advLabel = UIHelper.createI18NLabel("ADV_DB_DESC", SwingConstants.CENTER); skipStepBtn = UIHelper.createI18NButton("ADV_DB_TEST"); JComponent sep = builder.addSeparator(UIRegistry.getResourceString("ADV_TITLE"), cc.xyw(3, row, 1)); row += 2; builder.add(advLabel, cc.xyw(3, row, 1)); row += 2; tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(skipStepBtn, cc.xy(2, 1)); builder.add(tstPB.getPanel(), cc.xyw(3, row, 1)); row += 2; skipStepBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createDBBtn.setEnabled(false); skipStepBtn.setEnabled(false); boolean ok = skipDBCreate(); createDBBtn.setEnabled(true); skipStepBtn.setEnabled(true); advLabel.setText(UIRegistry.getResourceString(ok ? "ADV_DB_OK" : "ADV_DB_ERR")); } }); createDBBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createDB(); } }); if (UIRegistry.isMobile()) { skipStepBtn.setVisible(false); advLabel.setVisible(false); sep.setVisible(false); } progressBar.setVisible(false); DocumentAdaptor docAdp = new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { updateBtnUI(); } }; usernameTxt.getDocument().addDocumentListener(docAdp); passwordTxt.getDocument().addDocumentListener(docAdp); dbNameTxt.getDocument().addDocumentListener(docAdp); hostNameTxt.getDocument().addDocumentListener(docAdp); updateBtnUI(); }