List of usage examples for java.awt FlowLayout LEFT
int LEFT
To view the source code for java.awt FlowLayout LEFT.
Click Source Link
From source file:BlendCompositeDemo.java
public BlendCompositeDemo() { super("Blend Composites"); compositeTestPanel = new CompositeTestPanel(); compositeTestPanel.setComposite(BlendComposite.Average); add(compositeTestPanel);/*w w w. ja v a 2s . c om*/ combo = new JComboBox(BlendComposite.BlendingMode.values()); combo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { compositeTestPanel.setComposite(BlendComposite.getInstance( BlendComposite.BlendingMode.valueOf(combo.getSelectedItem().toString()), slider.getValue() / 100.0f)); } }); slider = new JSlider(0, 100, 100); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { BlendComposite blend = (BlendComposite) compositeTestPanel.getComposite(); blend = blend.derive(slider.getValue() / 100.0f); compositeTestPanel.setComposite(blend); } }); JPanel controls = new JPanel(new FlowLayout(FlowLayout.LEFT)); controls.add(combo); controls.add(new JLabel("0%")); controls.add(slider); controls.add(new JLabel("100%")); add(controls, BorderLayout.SOUTH); pack(); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:com.microsoft.alm.plugin.idea.ui.common.tabs.TabFormImpl.java
/** * Create the tab view if not already done *//*from w w w . j a v a2 s . com*/ protected void ensureInitialized() { if (!initialized) { createCustomView(); createFilterToolbar(); //toolbars final JPanel toolBarPanel; if (ApplicationManager.getApplication() != null) { final ActionToolbar prActionsToolbar = createToolbar(createActionsGroup()); final ActionToolbar feedbackActionsToolbar = createToolbar(createFeedbackGroup()); // left panel of the top toolbar final FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT, 0, JBUI.scale(3)); // give vertical padding final JPanel toolBarPanelLeft = new JPanel(flowLayout); toolBarPanelLeft.add(prActionsToolbar.getComponent()); toolBarPanelLeft.add(searchFilter); //entire top toolbar toolBarPanel = new JPanel(new BorderLayout()); toolBarPanel.add(toolBarPanelLeft, BorderLayout.LINE_START); toolBarPanel.add(feedbackActionsToolbar.getComponent(), BorderLayout.LINE_END); } else { //skip setup when called from unit tests toolBarPanel = new JPanel(); } //status panel with label and link final JPanel statusPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); statusLabel = new JLabel(); statusLink = new Hyperlink(); statusLink.setActionCommand(CMD_STATUS_LINK); statusPanel.add(statusLabel); statusPanel.add(statusLink); //tabPanel tabPanel = new JPanel(new BorderLayout()); tabPanel.add(toolBarPanel, BorderLayout.PAGE_START); tabPanel.add(scrollPanel, BorderLayout.CENTER); tabPanel.add(statusPanel, BorderLayout.PAGE_END); this.initialized = true; } }
From source file:at.tuwien.ifs.somtoolbox.apps.viewer.controls.DendogramView.java
/** * @param t// www . j av a 2 s . c o m * @param numClusters2 */ public void update(ClusteringTree t, int numClusters) { frame.setVisible(true); frame.getContentPane().removeAll(); try { // create spinner-panel clusterPanel = UiUtils.makeBorderedPanel(new FlowLayout(FlowLayout.LEFT, 10, 0), "Clusters"); spinnerCluster = new JSpinner(new SpinnerNumberModel(1, 1, maxCluster, 1)); spinnerCluster.setValue(numClusters); spinnerCluster.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if (mMainSpinnerCluster != null) { mMainSpinnerCluster.setValue(((JSpinner) e.getSource()).getValue()); } } }); UiUtils.fillPanel(clusterPanel, new JLabel("#"), spinnerCluster); frame.getContentPane().add(clusterPanel, BorderLayout.NORTH); // create graph VisualizationViewer g = generateGraph(t, numClusters); frame.getContentPane().add(g, BorderLayout.CENTER); frame.setSize(frame.getWidth() + 1, frame.getHeight() + 1); frame.setSize(frame.getWidth() - 1, frame.getHeight() - 1); } catch (Exception e) { e.printStackTrace(); } }
From source file:ErroresPorTraza.TabbedForm.java
private void setChartPorcentaje(int tt) { ErrorPorcentajePie aceptrech = new ErrorPorcentajePie(); ChartPanel chartpanel1 = aceptrech.getChartPanel("Porcentaje de errores", jTable1, tt); jPanelPorcentaje.removeAll();//from w w w . j a va2 s.com jPanelPorcentaje.setLayout(new FlowLayout(FlowLayout.LEFT)); jPanelPorcentaje.add(chartpanel1); this.setLocationRelativeTo(null); }
From source file:com.socrata.datasync.ui.MetadataJobTab.java
public MetadataJobTab(MetadataJob job, JFrame containingFrame) { this.metadataJob = job; mainFrame = containingFrame;/* w ww. j a va 2 s .com*/ // build tab panel form //jobPanel = new JPanel(new GridLayout(0,2)); jobPanel = new JPanel(new GridBagLayout()); // set FlowLayouts FlowLayout flowLeft = new FlowLayout(FlowLayout.LEFT, 0, 0); FlowLayout flowRight = new FlowLayout(FlowLayout.LEFT, 0, JOB_FIELD_VGAP); //Dataset ID Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Dataset ID", DATASET_ID_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 0)); JPanel datasetIDTextFieldContainer = new JPanel(flowRight); datasetIDTextField = new JTextField(); datasetIDTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); datasetIDTextFieldContainer.add(datasetIDTextField); jobPanel.add(datasetIDTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 0)); //Load Metadata Button jobPanel.add(new JLabel("")); JPanel loadMetadataButtonContainer = new JPanel(flowRight); JButton loadMetadataButton = new JButton("Load Current Dataset Metadata"); loadMetadataButton.addActionListener(new LoadMetadataActionListener()); loadMetadataButtonContainer.add(loadMetadataButton); loadMetadataButtonContainer.add(UIUtility.generateHelpBubble(LOAD_METADATA_TIP_TEXT)); jobPanel.add(loadMetadataButtonContainer, UIUtility.getGridBagFieldConstraints(1, 1)); //Title Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Title", TITLE_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 2)); JPanel titleTextFieldContainer = new JPanel(flowRight); titleTextField = new JTextField(); titleTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); titleTextFieldContainer.add(titleTextField); jobPanel.add(titleTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 2)); //Description Text Area jobPanel.add( UIUtility.generateLabelWithHelpBubble("Description", DESCRIPTION_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 3)); JPanel descriptionTextFieldContainer = new JPanel(); descriptionTextArea = new JTextArea(5, 33); descriptionTextArea.setLineWrap(true); descriptionTextArea.setWrapStyleWord(true); JScrollPane descriptionScrollPane = new JScrollPane(descriptionTextArea); descriptionTextFieldContainer.add(descriptionScrollPane); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 1; constraints.gridy = 3; constraints.weightx = 0; constraints.anchor = GridBagConstraints.LINE_START; constraints.ipadx = -10; //Not sure why, but text area was getting extra margin so left edge didn't line up with other fields jobPanel.add(descriptionTextFieldContainer, constraints); //Category Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Category", CATEGORY_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 4)); JPanel categoryTextFieldContainer = new JPanel(flowRight); categoryTextField = new JTextField(); categoryTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); categoryTextFieldContainer.add(categoryTextField); jobPanel.add(categoryTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 4)); //Tags/Keywords Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Tags/Keywords", KEYWORDS_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 5)); JPanel keywordsTextFieldContainer = new JPanel(flowRight); keywordsTextField = new JTextField(); keywordsTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); keywordsTextFieldContainer.add(keywordsTextField); jobPanel.add(keywordsTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 5)); //License Type Combo Box jobPanel.add( UIUtility.generateLabelWithHelpBubble("License Type", LICENSE_TYPE_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 6)); JPanel licenseTypeContainer = new JPanel(flowRight); licenseTypeComboBox = new JComboBox(); for (LicenseType licenseType : LicenseType.values()) { licenseTypeComboBox.addItem(licenseType); } licenseTypeContainer.add(licenseTypeComboBox); jobPanel.add(licenseTypeContainer, UIUtility.getGridBagFieldConstraints(1, 6)); //Data Provided By Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Data Provided By", DATA_PROVIDED_BY_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 7)); JPanel dataProvidedByTextFieldContainer = new JPanel(flowRight); dataProvidedByTextField = new JTextField(); dataProvidedByTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); dataProvidedByTextFieldContainer.add(dataProvidedByTextField); jobPanel.add(dataProvidedByTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 7)); //Source Link Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Source Link", SOURCE_LINK_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 8)); JPanel sourceLinkTextFieldContainer = new JPanel(flowRight); sourceLinkTextField = new JTextField(); sourceLinkTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); sourceLinkTextFieldContainer.add(sourceLinkTextField); jobPanel.add(sourceLinkTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 8)); //Contact Info Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Contact Info", CONTACT_INFO_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 9)); JPanel contactInfoTextFieldContainer = new JPanel(flowRight); contactInfoTextField = new JTextField(); contactInfoTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); contactInfoTextFieldContainer.add(contactInfoTextField); jobPanel.add(contactInfoTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 9)); //Command to execute jobPanel.add(UIUtility.generateLabelWithHelpBubble("Command to execute with scheduler", RUN_COMMAND_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 10)); JPanel runCommandTextFieldContainer = new JPanel(flowRight); runCommandTextField = new JTextField(DEFAULT_RUN_JOB_COMMAND); runCommandTextField.setPreferredSize(new Dimension(JOB_COMMAND_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); runCommandTextField.setEditable(false); runCommandTextField.addMouseListener(new JobCommandTextFieldListener()); runCommandTextFieldContainer.add(runCommandTextField); JButton copyJobCommandButton = new JButton("Copy to clipboard"); copyJobCommandButton.addActionListener(new CopyJobCommandListener()); runCommandTextFieldContainer.add(copyJobCommandButton); jobPanel.add(runCommandTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 10)); // Load job data into fields populateFieldsFromJobData(); jobTabTitleLabel = new JLabel(job.getJobFilename()); }
From source file:com.emental.mindraider.ui.dialogs.ConnectUriqaServerJDialog.java
/** * Constructor./*from www . java 2 s . co m*/ */ public ConnectUriqaServerJDialog() { super(Messages.getString("ConnectUriqaServerJDialog.title")); getContentPane().setLayout(new BorderLayout()); // north JPanel north = new JPanel(); north.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.serverUrl"))); uriqaServerUrl = new JTextField("http://sw.nokia.com/uriqa/", 31); uriqaServerUrl.setMinimumSize(new Dimension(TEXT_AREAS_WIDTH, uriqaServerUrl.getPreferredSize().height)); uriqaServerUrl.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) { connect(); } } public void keyReleased(KeyEvent keyEvent) { } public void keyTyped(KeyEvent keyEvent) { } }); north.add(uriqaServerUrl); getContentPane().add(north, BorderLayout.NORTH); // center JPanel center = new JPanel(); center.setLayout(new BorderLayout()); JPanel centerTop = new JPanel(); centerTop.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.resource"))); String[] knowUriqaUris = new String[] { "http://sw.nokia.com/VOC-1/term", "http://sw.nokia.com/MARS-3/Rank", "http://sw.nokia.com/MARS-3", "http://sw.nokia.com/schemas/nokia/MARS-3.1.rdf" }; resourceUri = new JComboBox(knowUriqaUris); resourceUri.setMinimumSize(new Dimension(TEXT_AREAS_WIDTH, resourceUri.getPreferredSize().height)); resourceUri.setEditable(true); centerTop.add(resourceUri); JPanel centerCenter = new JPanel(); centerCenter.setLayout(new FlowLayout(FlowLayout.LEFT)); centerCenter.setToolTipText(Messages.getString("ConnectUriqaServerJDialog.loadOverToolTip")); centerCenter.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.loadOver"))); JCheckBox loadOver = new JCheckBox(); loadOver.setSelected(true); loadOver.setEnabled(false); centerCenter.add(loadOver); JPanel centerBottom = new JPanel(); centerBottom.setLayout(new FlowLayout(FlowLayout.LEFT)); centerBottom.setToolTipText(Messages.getString("ConnectUriqaServerJDialog.addInferedToolTip")); centerBottom.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.addInfered"))); addInfered = new JCheckBox(); addInfered.setSelected(true); centerBottom.add(addInfered); center.add(centerTop, BorderLayout.NORTH); center.add(centerCenter, BorderLayout.CENTER); center.add(centerBottom, BorderLayout.SOUTH); getContentPane().add(center, BorderLayout.CENTER); // south JPanel south = new JPanel(); JButton uploadButton = new JButton(Messages.getString("ConnectUriqaServerJDialog.connect")); uploadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { connect(); } }); south.add(uploadButton); JButton cancelButton = new JButton(Messages.getString("ConnectUriqaServerJDialog.cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); south.add(cancelButton); getContentPane().add(south, BorderLayout.SOUTH); // show pack(); Gfx.centerAndShowWindow(this); }
From source file:com.emental.mindraider.ui.dialogs.AttachmentJDialog.java
/** * Concetructor./* w w w. ja va 2 s .co m*/ * * @param noteResource * The concept resource. * @param dragAndDropReference * The drag'n'drop reference. */ public AttachmentJDialog(ConceptResource conceptResource, DragAndDropReference dragAndDropReference) { super(Messages.getString("AttachmentJDialog.title")); this.conceptResource = conceptResource; getContentPane().setLayout(new BorderLayout()); JPanel p, pp; p = new JPanel(); p.setLayout(new BorderLayout()); JLabel intro = new JLabel("<html> " + Messages.getString("AttachmentJDialog.introduction") + " <br><br></html>"); p.add(intro, BorderLayout.NORTH); p.add(new JLabel("<html> " + Messages.getString("AttachmentJDialog.description") + "</html>"), BorderLayout.CENTER); description = new JTextField(38); pp = new JPanel(new FlowLayout(FlowLayout.LEFT)); pp.add(description); p.add(pp, BorderLayout.SOUTH); getContentPane().add(p, BorderLayout.NORTH); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.setBorder(new TitledBorder(Messages.getString("AttachmentJDialog.resource"))); ButtonGroup attachType = new ButtonGroup(); JPanel webPanel = new JPanel(); webPanel.setLayout(new BorderLayout()); webType = new JRadioButton(Messages.getString("AttachmentJDialog.web")); webType.setActionCommand(WEB); webType.addActionListener(this); webType.setSelected(true); attachType.add(webType); webPanel.add(webType, BorderLayout.NORTH); urlTextField = new JTextField("http://", 35); urlTextField.selectAll(); urlTextField.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) { attach(); } } public void keyReleased(KeyEvent keyEvent) { } public void keyTyped(KeyEvent keyEvent) { } }); p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); p.add(new JLabel(" ")); p.add(urlTextField); webPanel.add(p, BorderLayout.SOUTH); mainPanel.add(webPanel, BorderLayout.NORTH); JPanel localPanel = new JPanel(); localPanel.setLayout(new BorderLayout()); JRadioButton localType = new JRadioButton(Messages.getString("AttachmentJDialog.local")); localType.setActionCommand(LOCAL); localType.addActionListener(this); localPanel.add(localType, BorderLayout.NORTH); pathTextField = new JTextField(35); pathTextField.setEnabled(false); browseButton = new JButton(Messages.getString("AttachmentJDialog.browse")); browseButton.setToolTipText(Messages.getString("AttachmentJDialog.browseTip")); browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); fc.setApproveButtonText(Messages.getString("AttachmentJDialog.attach")); fc.setControlButtonsAreShown(true); fc.setDialogTitle(Messages.getString("AttachmentJDialog.chooseAttachment")); fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int returnVal = fc.showOpenDialog(AttachmentJDialog.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); pathTextField.setText(file.toString()); } } }); browseButton.setEnabled(false); pp = new JPanel(); pp.setLayout(new BorderLayout()); p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); p.add(new JLabel(" ")); pp.add(p, BorderLayout.NORTH); p.add(pathTextField); p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.RIGHT)); p.add(browseButton); pp.add(p, BorderLayout.SOUTH); localPanel.add(pp, BorderLayout.SOUTH); attachType.add(localType); mainPanel.add(localPanel, BorderLayout.SOUTH); getContentPane().add(mainPanel, BorderLayout.CENTER); // buttons p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.CENTER)); JButton addButton = new JButton(Messages.getString("AttachmentJDialog.attach")); p.add(addButton); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { attach(); } }); JButton cancelButton = new JButton(Messages.getString("AttachmentJDialog.cancel")); p.add(cancelButton); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AttachmentJDialog.this.dispose(); } }); getContentPane().add(p, BorderLayout.SOUTH); /* * drag and drop initialization */ if (dragAndDropReference != null) { if (dragAndDropReference.getType() == DragAndDropReference.BROWSER_LINK) { urlTextField.setText(dragAndDropReference.getReference()); localType.setSelected(false); webType.setSelected(true); enableWebTypeButtons(); } else { pathTextField.setText(dragAndDropReference.getReference()); localType.setSelected(true); webType.setSelected(false); enableLocalTypeButtons(); } description.setText(dragAndDropReference.getTitle()); } pack(); Gfx.centerAndShowWindow(this); }
From source file:net.mitnet.tools.pdf.book.publisher.ui.gui.BookPublisherGUI2.java
/** * Initialise widgets./*from ww w.j a va 2s .c om*/ */ protected void initComponents() { // frame this.frame = new JFrame(); this.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.frame.setTitle(FRAME_TITLE); // input dir panel inputDirLabel = new JLabel(); inputDirLabel.setText("Input Folder:"); inputDirField = new JTextField(); inputDirField.setColumns(FILE_TEXTFIELD_WIDTH); inputDirButton = new JButton(); inputDirButton.setText("Browse ..."); inputDirButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { inputDirButtonActionHandler(event); } }); JPanel inputDirPanel = new JPanel(); // inputDirPanel.setLayout( new BoxLayout( inputDirPanel, BoxLayout.X_AXIS ) ); inputDirPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); inputDirPanel.add(inputDirLabel); inputDirPanel.add(inputDirField); inputDirPanel.add(inputDirButton); // output dir panel outputDirLabel = new JLabel(); outputDirLabel.setText("Output Folder:"); outputDirField = new JTextField(); outputDirField.setColumns(FILE_TEXTFIELD_WIDTH); outputDirButton = new JButton(); outputDirButton.setText("Browse ..."); outputDirButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { outputDirButtonActionHandler(event); } }); JPanel outputDirPanel = new JPanel(); // outputDirPanel.setLayout( new BoxLayout( outputDirPanel, BoxLayout.X_AXIS ) ); outputDirPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); outputDirPanel.add(outputDirLabel); outputDirPanel.add(outputDirField); outputDirPanel.add(outputDirButton); // document control panel docControlPanel = new JPanel(); docControlPanel.setLayout(new BoxLayout(docControlPanel, BoxLayout.Y_AXIS)); docControlPanel.add(inputDirPanel); docControlPanel.add(outputDirPanel); // Border docControlPanelBorder = BorderFactory.createTitledBorder("Documents"); Border docControlPanelBorder = BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Documents"), BorderFactory.createEmptyBorder(5, 5, 5, 5)); docControlPanel.setBorder(docControlPanelBorder); // publish button publishButton = new JButton(); publishButton.setText("Publish"); publishButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { publishButtonActionHandler(event); } }); // status message label statusMessageLabel = new JLabel(); // String statusMessageText = "Press " + publishButton.getText() + " to start."; String statusMessageText = ""; statusMessageLabel.setText(statusMessageText); // statusMessageLabel.setVisible(false); // progress bar progressBar = new JProgressBar(); // exit button exitButton = new JButton(); exitButton.setText("Exit"); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { exitButtonActionHandler(event); } }); // build main panel JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(docControlPanel); // mainPanel.add(new Spacer()); mainPanel.add(publishButton); // mainPanel.add(new Spacer()); mainPanel.add(progressBar); // mainPanel.add(new Spacer()); mainPanel.add(statusMessageLabel); // mainPanel.add(new Spacer()); mainPanel.add(exitButton); // add main panel to frame this.frame.getContentPane().setLayout(new BoxLayout(this.frame.getContentPane(), BoxLayout.Y_AXIS)); this.frame.getContentPane().add(mainPanel); // this.frame.setSize(800,600); this.frame.pack(); }
From source file:com.microsoft.alm.plugin.idea.common.ui.common.tabs.TabFormImpl.java
/** * Create the tab view if not already done *///from w w w .java2s. com protected void ensureInitialized() { if (!initialized) { createCustomView(); createFilterToolbar(); //toolbars final JPanel toolBarPanel; if (ApplicationManager.getApplication() != null) { final ActionToolbar prActionsToolbar = createToolbar(createActionsGroup()); final ActionToolbar feedbackActionsToolbar = createToolbar(createFeedbackGroup()); final ActionToolbar optionsActionsToolbar = createToolbar(createOptionsGroup()); // left panel of the top toolbar final FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT, 0, JBUI.scale(3)); // give vertical padding final JPanel toolBarPanelLeft = new JPanel(flowLayout); toolBarPanelLeft.add(prActionsToolbar.getComponent()); toolBarPanelLeft.add(searchFilter); addCustomTools(toolBarPanelLeft); // middle panel of the top toolbar final FlowLayout flowLayout2 = new FlowLayout(FlowLayout.LEFT, 0, JBUI.scale(3)); // give vertical padding final JPanel toolBarPanelMiddle = new JPanel(flowLayout2); toolBarPanelMiddle.add(optionsActionsToolbar.getComponent()); SwingHelper.setMargin(toolBarPanelMiddle, new Insets(JBUI.scale(2), JBUI.scale(15), 0, 0)); //entire top toolbar toolBarPanel = new JPanel(new BorderLayout()); toolBarPanel.add(toolBarPanelLeft, BorderLayout.LINE_START); toolBarPanel.add(toolBarPanelMiddle, BorderLayout.CENTER); toolBarPanel.add(feedbackActionsToolbar.getComponent(), BorderLayout.LINE_END); } else { //skip setup when called from unit tests toolBarPanel = new JPanel(); } //status panel with label and link final JPanel statusPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); statusLabel = new JLabel(); statusLink = new Hyperlink(); statusLink.setActionCommand(CMD_STATUS_LINK); statusPanel.add(statusLabel); statusPanel.add(statusLink); //tabPanel tabPanel = new JPanel(new BorderLayout()); tabPanel.add(toolBarPanel, BorderLayout.PAGE_START); tabPanel.add(scrollPanel, BorderLayout.CENTER); tabPanel.add(statusPanel, BorderLayout.PAGE_END); this.initialized = true; } }
From source file:com.k42b3.aletheia.response.html.Images.java
public Images() { super();// w w w . j a v a 2 s. c o m executorService = Executors.newFixedThreadPool(6); // settings this.setTitle("Images"); this.setLocation(100, 100); this.setPreferredSize(new Dimension(360, 600)); this.setMinimumSize(this.getSize()); this.setResizable(false); this.setLayout(new BorderLayout()); // list model = new DefaultListModel<URL>(); list = new JList<URL>(model); list.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { btnDownload.setEnabled(list.getSelectedIndex() != -1); } }); list.setCellRenderer(new ImageCellRenderer()); scp = new JScrollPane(list); scp.setBorder(new EmptyBorder(4, 4, 4, 4)); this.add(scp, BorderLayout.CENTER); // buttons JPanel panelButtons = new JPanel(); FlowLayout fl = new FlowLayout(); fl.setAlignment(FlowLayout.LEFT); panelButtons.setLayout(fl); btnDownload = new JButton("Download"); btnDownload.addActionListener(new DownloadHandler()); btnDownload.setEnabled(false); JButton btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new CloseHandler()); lblInfo = new JLabel(""); panelButtons.add(btnDownload); panelButtons.add(btnCancel); panelButtons.add(lblInfo); this.add(panelButtons, BorderLayout.SOUTH); this.pack(); }