Java Code Examples for javax.swing.JPanel#add()

The following examples show how to use javax.swing.JPanel#add() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private JPanel createProductsPanel() {
    final TableLayout layout = new TableLayout(1);
    layout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
    layout.setTableFill(TableLayout.Fill.HORIZONTAL);
    layout.setTableWeightX(1.0);
    layout.setRowWeightY(0, 0.0);
    layout.setRowWeightY(1, 1.0);
    layout.setRowFill(1, TableLayout.Fill.BOTH);

    final JPanel panel = new JPanel(layout);
    panel.add(new TitledSeparator("Product Sources"));
    locationsPane = new ProductLocationsPane();
    locationsPane.setPreferredSize(new Dimension(150, 80));
    panel.add(locationsPane);
    return panel;
}
 
Example 2
Source Project: arcgis-runtime-demo-java   File: UI.java    License: Apache License 2.0 6 votes vote down vote up
public static JPanel createQueryResultPanel(DefaultTableModel tblQueryResultModel) {
  JPanel queryPanel = new JPanel();
  queryPanel.setMaximumSize(new Dimension(1000, 200));
  queryPanel.setPreferredSize(new Dimension(1000, 200));
  queryPanel.setLayout(new BoxLayout(queryPanel, BoxLayout.Y_AXIS));
  queryPanel.setVisible(true);
  
  final JTable tblQueryResult = new JTable(tblQueryResultModel);
   /* tblQueryResult.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    
    @Override
    public void valueChanged(ListSelectionEvent e) {
      int row = tblQueryResult.getSelectedRow();
      Point g = (Point) tblQueryResultModel.getValueAt(row, 4);
      map.zoomTo(g);
    }
  });*/
    
    JScrollPane tblQueryScrollPane = new JScrollPane(tblQueryResult);
    //tblQueryScrollPane.getViewport().setBackground(UI.COLOR_PURPLE);
    queryPanel.add(tblQueryScrollPane);
    
  return queryPanel;
}
 
Example 3
Source Project: OpERP   File: ListWarehousePane.java    License: MIT License 6 votes vote down vote up
public ListWarehousePane() {
	pane = new JPanel();
	pane.setLayout(new MigLayout("fill"));
	table = new JTable(tableModel);
	table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	table.addMouseListener(new MouseAdapter() {
		@Override
		public void mousePressed(MouseEvent e) {
			if (SwingUtilities.isLeftMouseButton(e)
					&& e.getClickCount() == 2
					&& table.getSelectedRow() != -1) {
				Warehouse warehouse = tableModel.getRow(table
						.getSelectedRow());
				warehouseDetailsPane.show(warehouse, getPane());

			}
		}
	});

	final JScrollPane scrollPane = new JScrollPane(table,
			JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	pane.add(scrollPane, "grow");

}
 
Example 4
Source Project: collect-earth   File: PropertiesDialog.java    License: MIT License 6 votes vote down vote up
private JComponent getOperationModePanel() {
	final GridBagConstraints constraints = new GridBagConstraints();
	constraints.gridx = 0;
	constraints.gridy = 0;
	constraints.anchor = GridBagConstraints.LINE_START;
	constraints.insets = new Insets(5, 5, 5, 5);
	constraints.weightx = 1.0;
	constraints.fill = GridBagConstraints.HORIZONTAL;

	final JPanel typeOfUsePanel = new JPanel(new GridBagLayout());
	final Border border = new TitledBorder(new BevelBorder(BevelBorder.LOWERED),
			Messages.getString("OptionWizard.2")); //$NON-NLS-1$
	typeOfUsePanel.setBorder(border);

	JPanel serverPanel = getServerPanel();
	typeOfUsePanel.add(serverPanel, constraints);

	return typeOfUsePanel;
}
 
Example 5
Source Project: iBioSim   File: AnalysisView.java    License: Apache License 2.0 5 votes vote down vote up
private JPanel createReportOptions()
{
  JPanel reportOptions = new JPanel();
  report = new JLabel("Report Options:");
  reportOptions.add(report);

  concentrations = new JCheckBox("Report Concentrations");
  concentrations.setEnabled(true);
  reportOptions.add(concentrations);
  concentrations.addActionListener(this);

  genRuns = new JCheckBox("Do Not Generate Runs");
  genRuns.setEnabled(true);
  reportOptions.add(genRuns);
  genRuns.addActionListener(this);

  append = new JCheckBox("Append Simulation Runs");
  append.setEnabled(true);
  reportOptions.add(append);
  append.addActionListener(this);

  genStats = new JCheckBox("Generate Statistics");
  genStats.setEnabled(true);
  reportOptions.add(genStats);
  genStats.addActionListener(this);
  return reportOptions;
}
 
Example 6
public void initializeGUI(Consumer<int[]> setPricesAction, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader) {
	PricesModel worldModel = new PricesModel(pricesOnPlayer);
	JTable table = JTableFactory.createJTable(worldModel);
	table.setDefaultRenderer(ImageIds.class, new ImageTableRenderer(imageInfoReader));
	table.setRowHeight(50);
	table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	table.getColumnModel().getColumn(0).setPreferredWidth(100);
	table.getColumnModel().getColumn(1).setPreferredWidth(250);
	table.getColumnModel().getColumn(2).setPreferredWidth(100);
	JTableFactory.applyImageToHeaderColumn(table, table.getColumnModel().getColumn(2), ImageIds.SMALL_GOLD_COIN, imageInfoReader);
	table.setAutoCreateRowSorter(true);
	table.getRowSorter().toggleSortOrder(1);
	JScrollPane scrollPane = JScrollPaneFactory.createScrollPane(table);
	scrollPane.setBounds(15, 15, 468, 700);
	addComponent(scrollPane);
	
	JPanel buttonPane = new JPanel();
	buttonPane.setOpaque(false);
	buttonPane.setBounds(0, 730, 488, 75);
	buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
	addComponent(buttonPane);
	
	JButton okButton = JButtonFactory.createButton("OK", imageInfoReader, soundIdReader);
	okButton.setActionCommand("OK");
	buttonPane.add(okButton);
	addActionHandlers(setPricesAction, okButton, worldModel, this, pricesOnPlayer);
	getRootPane().setDefaultButton(okButton);
	
	SwingUtils.makeTransparant(table, scrollPane);
}
 
Example 7
protected JPanel createTickUnitPanel() {
    JPanel tickUnitPanel = new JPanel(new LCBLayout(3));
    tickUnitPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    tickUnitPanel.add(new JPanel());
    this.autoTickUnitSelectionCheckBox = new JCheckBox(
            localizationResources.getString("Auto-TickUnit_Selection"),
            this.autoTickUnitSelection);
    this.autoTickUnitSelectionCheckBox.setActionCommand("AutoTickOnOff");
    this.autoTickUnitSelectionCheckBox.addActionListener(this);
    tickUnitPanel.add(this.autoTickUnitSelectionCheckBox);
    tickUnitPanel.add(new JPanel());

    return tickUnitPanel;
}
 
Example 8
EditorView(REditorComponent editor) {
            super(new BorderLayout());
            
            editor.clearScrollBorders();
            add(editor, BorderLayout.CENTER);
//            add(new ScrollableContainer(editorContainer), BorderLayout.CENTER);

            JToolBar controls = new JToolBar(JToolBar.VERTICAL);
            controls.setFloatable(false);
            controls.setBorderPainted(false);
            controls.add(runAction);
            controls.add(cancelAction);
            controls.addSeparator();
            controls.add(loadAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            controls.add(saveAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            controls.add(editAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            
            JPanel controlsContainer = new JPanel(new BorderLayout());
            controlsContainer.setOpaque(false);
            controlsContainer.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createMatteBorder(0, 0, 0, 1, UIManager.getColor("Separator.foreground")), // NOI18N
                    BorderFactory.createEmptyBorder(1, 1, 1, 1)));
            controlsContainer.add(controls, BorderLayout.CENTER);
            add(controlsContainer, BorderLayout.WEST);
            
            // size to always show Run and Stop buttons
            int h = controls.getComponent(0).getPreferredSize().height;
            h += controls.getComponent(1).getPreferredSize().height + 2;
            setMinimumSize(new Dimension(0, h));
        }
 
Example 9
public ProgressDialog(String description, int max, ImageInfoReader imageInfoReader) {
	super("Processing turns...");
	
	getContentPane().setLayout(null);
	IconUtils.setIcon(this);
	this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	setCursor(Cursors.CURSOR);
	
	int width = 450;
	int height = 210;
	
	setSize(width, height);
	setResizable(false);
	setUndecorated(true);
	((JComponent)getRootPane()).setBorder(BorderFactory.createLineBorder(Color.WHITE, 5));
	JPanel gradientPanel = new TiledImagePanel(imageInfoReader);
	gradientPanel.setBounds(0, 0, width, height);
	gradientPanel.setLayout(null);
	
	getContentPane().add(gradientPanel);
	
	this.setLocationRelativeTo(null);
	
	JLabel label = JLabelFactory.createJLabel(description);
	label.setBounds(16, 16, 415, 50);
	gradientPanel.add(label);
	
	progressBar = new TiledHorizontalImageProgressBar(0, max, ImageIds.PROGRESSBAR_BACKGROUND, imageInfoReader);
	progressBar.setBounds(16, 70, 415, 30);
	gradientPanel.add(progressBar);
}
 
Example 10
private void addMainArea(Container container) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    addTopArea(panel);
    panel.add(Box.createVerticalStrut(10));
    addBottomArea(panel);
    panel.add(Box.createVerticalGlue());

    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    container.add(panel);
}
 
Example 11
public RootSequenceEditor(PartitionDataList dataList, int row) {

        this.dataList = dataList;
        this.row = row;

        ancestralSequenceField = new JTextField("", 10);
        window = new JDialog(owner, "Setup root sequence for partition " + (row + 1));
        optionPanel = new OptionsPanel(12, 12, SwingConstants.CENTER);

        optionPanel.setOpaque(false);

        setAncestralSequence();

        // Buttons
        JPanel buttonsHolder = new JPanel();
        buttonsHolder.setOpaque(false);

        cancel = new JButton("Cancel", Utils.createImageIcon(Utils.CLOSE_ICON));
        cancel.addActionListener(new ListenCancel());
        buttonsHolder.add(cancel);

        done = new JButton("Done", Utils.createImageIcon(Utils.CHECK_ICON));
        done.addActionListener(new ListenOk());
        buttonsHolder.add(done);

        // Window
        owner = Utils.getActiveFrame();
        window.setLocationRelativeTo(owner);
        window.getContentPane().setLayout(new BorderLayout());
        window.getContentPane().add(optionPanel, BorderLayout.CENTER);
        window.getContentPane().add(buttonsHolder, BorderLayout.SOUTH);
        window.pack();

    }
 
Example 12
public void addItem(JPanel p, JComponent c, int x, int y, int w, int h, int align) {

		GridBagConstraints gc = new GridBagConstraints();
		gc.gridx = x;
		gc.gridy = y;
		gc.gridwidth = w;
		gc.gridheight = h;
		gc.weightx = 100.0;
		gc.weighty = 100.0;
		gc.insets = new Insets(2,2,2,2);
		gc.anchor = align;
		gc.fill = GridBagConstraints.NONE;
		p.add(c,gc);

	}
 
Example 13
public TimeablePanel(T timeable, String title, int maximumProgressValue)
{
	this.timeable = timeable;

	setLayout(new BorderLayout());
	setBorder(new EmptyBorder(7, 0, 0, 0));

	JPanel topContainer = new JPanel();
	topContainer.setBorder(new EmptyBorder(7, 7, 6, 0));
	topContainer.setLayout(new BorderLayout());
	topContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR);

	icon.setMinimumSize(new Dimension(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT));
	farmingContractIcon.setMinimumSize(new Dimension(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT));

	JPanel infoPanel = new JPanel();
	infoPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
	infoPanel.setLayout(new GridLayout(2, 1));
	infoPanel.setBorder(new EmptyBorder(4, 4, 4, 0));

	text = new JShadowedLabel(title);
	text.setFont(FontManager.getRunescapeSmallFont());
	text.setForeground(Color.WHITE);

	estimate.setFont(FontManager.getRunescapeSmallFont());
	estimate.setForeground(Color.GRAY);

	infoPanel.add(text);
	infoPanel.add(estimate);

	topContainer.add(icon, BorderLayout.WEST);
	topContainer.add(farmingContractIcon, BorderLayout.EAST);
	topContainer.add(infoPanel, BorderLayout.CENTER);

	progress.setValue(0);
	progress.setMaximumValue(maximumProgressValue);

	add(topContainer, BorderLayout.NORTH);
	add(progress, BorderLayout.SOUTH);
}
 
Example 14
private JPanel getAiTypePanel() {
    final JPanel panel = new JPanel(new MigLayout("insets 0"));
    panel.add(new JLabel(MText.get(_S6)));
    panel.add(aiComboBox, "w 100%, left");
    return panel;
}
 
Example 15
private void initDisplayColumnsTab() {
	bColumnsChanged = false;
	jpDisplayColumns = new JPanel();
	jlDisplayColumns = new JLabel(res.getString("DPreferences.jlDisplayColumns.text"));

	bEnableEntryName = kstColumns.getEnableEntryName();
	jcbEnableEntryName = new JCheckBox(res.getString("DPreferences.jcbEnableEntryName.text"), bEnableEntryName);
	// fix for problem that without entry name a lot of things do not work
	jcbEnableEntryName.setSelected(true);
	jcbEnableEntryName.setEnabled(false);

	bEnableAlgorithm = kstColumns.getEnableAlgorithm();
	jcbEnableAlgorithm = new JCheckBox(res.getString("DPreferences.jcbEnableAlgorithm.text"), bEnableAlgorithm);

	bEnableKeySize = kstColumns.getEnableKeySize();
	jcbEnableKeySize = new JCheckBox(res.getString("DPreferences.jcbEnableKeySize.text"), bEnableKeySize);
	jcbEnableKeySize.setSelected(bEnableKeySize);

	bEnableCurve = kstColumns.getEnableCurve();
	jcbEnableCurve = new JCheckBox(res.getString("DPreferences.jcbEnableCurve.text"), bEnableCurve);
	jcbEnableCurve.setSelected(bEnableCurve);

	bEnableCertificateExpiry = kstColumns.getEnableCertificateExpiry();
	jcbEnableCertificateExpiry = new JCheckBox(res.getString("DPreferences.jcbEnableCertificateExpiry.text"),
			bEnableCertificateExpiry);
	jcbEnableCertificateExpiry.setSelected(bEnableCertificateExpiry);

	bEnableLastModified = kstColumns.getEnableLastModified();
	jcbEnableLastModified = new JCheckBox(res.getString("DPreferences.jcbEnableLastModified.text"),
			bEnableLastModified);
	jcbEnableLastModified.setSelected(bEnableLastModified);

	bEnableSKI = kstColumns.getEnableSKI();
	jcbEnableSKI = new JCheckBox(res.getString("DPreferences.jcbEnableSKI.text"), bEnableSKI);
	jcbEnableSKI.setSelected(bEnableSKI);

	bEnableAKI = kstColumns.getEnableAKI();
	jcbEnableAKI = new JCheckBox(res.getString("DPreferences.jcbEnableAKI.text"), bEnableAKI);
	jcbEnableAKI.setSelected(bEnableAKI);

	bEnableIssuerDN = kstColumns.getEnableIssuerDN();
	jcbEnableIssuerDN = new JCheckBox(res.getString("DPreferences.jcbEnableIssuerDN.text"), bEnableIssuerDN);
	jcbEnableIssuerDN.setSelected(bEnableIssuerDN);

	bEnableSubjectDN = kstColumns.getEnableSubjectDN();
	jcbEnableSubjectDN = new JCheckBox(res.getString("DPreferences.jcbEnableSubjectDN.text"), bEnableSubjectDN);
	jcbEnableSubjectDN.setSelected(bEnableSubjectDN);

	bEnableIssuerCN = kstColumns.getEnableIssuerCN();
	jcbEnableIssuerCN = new JCheckBox(res.getString("DPreferences.jcbEnableIssuerCN.text"), bEnableIssuerCN);
	jcbEnableIssuerCN.setSelected(bEnableIssuerCN);

	bEnableSubjectCN = kstColumns.getEnableSubjectCN();
	jcbEnableSubjectCN = new JCheckBox(res.getString("DPreferences.jcbEnableSubjectCN.text"), bEnableSubjectCN);
	jcbEnableSubjectCN.setSelected(bEnableSubjectCN);

	bEnableIssuerO = kstColumns.getEnableIssuerO();
	jcbEnableIssuerO = new JCheckBox(res.getString("DPreferences.jcbEnableIssuerO.text"), bEnableIssuerO);
	jcbEnableIssuerO.setSelected(bEnableIssuerO);

	bEnableSubjectO = kstColumns.getEnableSubjectO();
	jcbEnableSubjectO = new JCheckBox(res.getString("DPreferences.jcbEnableSubjectO.text"), bEnableSubjectO);
	jcbEnableSubjectO.setSelected(bEnableSubjectO);

	jlExpirationWarnDays = new JLabel(res.getString("DPreferences.jlExpiryWarning.text"));
	jtfExpirationWarnDays = new JTextField();
	jtfExpirationWarnDays.setColumns(3);
	jtfExpirationWarnDays.setText(Integer.toString(expiryWarnDays));

	jpDisplayColumns.setLayout(new MigLayout("insets dialog, fill", "[][]", ""));
	jpDisplayColumns.add(jlDisplayColumns, "left, wrap");
	jpDisplayColumns.add(jcbEnableEntryName, "left");
	jpDisplayColumns.add(jcbEnableAlgorithm, "left, wrap");
	jpDisplayColumns.add(jcbEnableKeySize, "left");
	jpDisplayColumns.add(jcbEnableCurve, "left, wrap");
	jpDisplayColumns.add(jcbEnableCertificateExpiry, "left");
	jpDisplayColumns.add(jcbEnableLastModified, "left, wrap");
	jpDisplayColumns.add(jcbEnableSKI, "left");
	jpDisplayColumns.add(jcbEnableAKI, "left, wrap");
	jpDisplayColumns.add(jcbEnableIssuerDN, "left");
	jpDisplayColumns.add(jcbEnableSubjectDN, "left, wrap");
	jpDisplayColumns.add(jcbEnableIssuerCN, "left");
	jpDisplayColumns.add(jcbEnableSubjectCN, "left, wrap");
	jpDisplayColumns.add(jcbEnableIssuerO, "left");
	jpDisplayColumns.add(jcbEnableSubjectO, "left, wrap");
	jpDisplayColumns.add(jlExpirationWarnDays, "left, spanx, split");
	jpDisplayColumns.add(jtfExpirationWarnDays, "wrap");
}
 
Example 16
@Override
protected void addCustomComponents(@Nonnull final JPanel panel,
                                   @Nonnull final GridBagConstraints gbdata) {
  final JButton buttonClipboardText = new JButton(ICON_PLANTUML);
  buttonClipboardText.setName("BUTTON.PLANTUML");
  buttonClipboardText.setToolTipText("Copy formed PlantUML script to clipboard");
  buttonClipboardText.addActionListener((ActionEvent e) -> {
    Toolkit.getDefaultToolkit().getSystemClipboard()
        .setContents(new StringSelection(preprocessEditorText(editor.getText())), null);
  });

  checkBoxGroupTopics = new JCheckBox("Group topics  ", this.modeGroupTopics);
  checkBoxGroupTopics.setName(PROPERTY_TOPICS_GROUP);
  checkBoxGroupTopics.setToolTipText("Group all topics on scheme together");
  checkBoxGroupTopics.addActionListener((x) -> {
    this.onConfigCheckboxChange(checkBoxGroupTopics);
  });

  checkBoxGroupStores = new JCheckBox("Group stores  ", this.modeGroupStores);
  checkBoxGroupStores.setName(PROPERTY_STORE_GROUP);
  checkBoxGroupStores.setToolTipText("Group all stores on scheme together");
  checkBoxGroupStores.addActionListener((x) -> {
    this.onConfigCheckboxChange(checkBoxGroupStores);
  });

  checkBoxOrtho = new JCheckBox("Orthogonal lines  ", this.modeOrtho);
  checkBoxOrtho.setName(PROPERTY_ORTHOGONAL);
  checkBoxOrtho.setToolTipText("Orthogonal connector lines");
  checkBoxOrtho.addActionListener((x) -> {
    this.onConfigCheckboxChange(checkBoxOrtho);
  });

  checkBoxHorizontal = new JCheckBox("Horizontal layout  ", this.modeHoriz);
  checkBoxHorizontal.setName(PROPERTY_LAYOUT_HORIZ);
  checkBoxHorizontal.setToolTipText("Horizontal layouting of components");
  checkBoxHorizontal.addActionListener((x) -> {
    this.onConfigCheckboxChange(checkBoxHorizontal);
  });

  panel.add(buttonClipboardText, gbdata);
  panel.add(checkBoxGroupTopics, gbdata);
  panel.add(checkBoxGroupStores, gbdata);
  panel.add(checkBoxOrtho, gbdata);
  panel.add(checkBoxHorizontal, gbdata);
}
 
Example 17
public TextGetPutPane(PreferencesExt prefs) {
  super(true);

  this.prefs = prefs;
  /*
   * ta = new JTextArea();
   * ta.setFont( new Font("Monospaced", Font.PLAIN, 12));
   */

  // combo box holds a list of urls
  cb = new JComboBox();
  cb.setEditable(true);
  if (prefs != null)
    setList((ArrayList) prefs.getBean("list", null));

  if (addFileButton) {
    fileChooserReader = new FileManager(null, null, "xml", "THREDDS catalogs",
        (prefs == null) ? null : (PreferencesExt) prefs.node("fileChooserReader"));
    fileAction = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        String filename = fileChooserReader.chooseFilename();
        if (filename == null)
          return;
        cb.setSelectedItem("file:" + filename);
      }
    };
    BAMutil.setActionProperties(fileAction, "FileChooser", "open Local dataset...", false, 'L', -1);
  }

  JButton getButton = new JButton("Get");
  getButton.setToolTipText("GET URL contents");
  getButton.addActionListener(e -> setURL((String) cb.getSelectedItem()));
  JButton validButton = new JButton("Validate");
  validButton.setToolTipText("Validate catalog");
  validButton.addActionListener(e -> validate((String) cb.getSelectedItem()));
  JButton putButton = new JButton("Put");
  putButton.setToolTipText("PUT URL contents");
  putButton.addActionListener(e -> {
    try {
      putURL((String) cb.getSelectedItem());
    } catch (IOException e1) {
      javax.swing.JOptionPane.showMessageDialog(null, e1.getMessage());
    }
    firePutActionEvent();
  });

  /*
   * AbstractButton infoButton = BAMutil.makeButtcon("Information", "Show Info", false);
   * infoButton.addActionListener(new ActionListener() {
   * public void actionPerformed(ActionEvent e) {
   * clear();
   * if (httpSession != null)
   * setText( httpSession.getInfo());
   * }
   * });
   */

  buttPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
  if (null != fileAction)
    BAMutil.addActionToContainer(buttPanel, fileAction);
  buttPanel.add(getButton);
  buttPanel.add(validButton);
  buttPanel.add(putButton);
  // buttPanel.add( infoButton);

  JPanel topPanel = new JPanel(new BorderLayout());
  topPanel.add(new JLabel("URL:"), BorderLayout.WEST);
  topPanel.add(cb, BorderLayout.CENTER);
  topPanel.add(buttPanel, BorderLayout.EAST);

  // setLayout( new BorderLayout());
  add(topPanel, BorderLayout.NORTH);
  // add( new JScrollPane(ta), BorderLayout.CENTER);
}
 
Example 18
Source Project: uima-uimaj   File: ListSelector.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Instantiates a new list selector.
 *
 * @param listData the list data
 */
public ListSelector(Object[] listData) {
  for (int i = 0; i < listData.length; i++)
    listModel.addElement(listData[i]);

  setLayout(new BorderLayout(4, 4));
  list = new JList(listModel);
  list.setFixedCellWidth(200);
  list.setVisibleRowCount(3);
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  Border etchedBorder = BorderFactory.createEtchedBorder();
  list.setBorder(etchedBorder);

  JScrollPane scrollPane = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
          ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
  add(scrollPane, BorderLayout.CENTER);

  JPanel controlPanel = new JPanel();
  GridBagLayout gbl = new GridBagLayout();
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.insets = new Insets(2, 2, 2, 2);
  controlPanel.setLayout(gbl);

  addField = new JTextField(6);
  addField.addActionListener(this);

  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.anchor = GridBagConstraints.NORTHEAST;
  controlPanel.add(addField, gbc);

  gbc.gridx = 1;
  gbc.anchor = GridBagConstraints.NORTHWEST;

  addButton = new SmallButton("Add");
  addButton.addActionListener(this);
  controlPanel.add(addButton, gbc);

  gbc.gridx = 0;
  gbc.gridy = 1;
  gbc.anchor = GridBagConstraints.WEST;

  JPanel movePanel = new JPanel();
  movePanel.setLayout(new GridLayout(1, 2, 4, 4));

  moveUpButton = new ImageButton(Images.UP);
  moveUpButton.addActionListener(this);
  movePanel.add(moveUpButton);

  moveDownButton = new ImageButton(Images.DOWN);
  moveDownButton.addActionListener(this);
  movePanel.add(moveDownButton);

  controlPanel.add(movePanel, gbc);

  gbc.gridx = 1;
  gbc.anchor = GridBagConstraints.WEST;

  gbc.anchor = GridBagConstraints.WEST;
  removeButton = new SmallButton("Remove");
  removeButton.addActionListener(this);
  controlPanel.add(removeButton, gbc);

  add(controlPanel, BorderLayout.EAST);
}
 
Example 19
/**
 * @return A Component that is also BindingCapable
 * 
 *         Make the Widget panel and keep a reference to it in a collection
 *         so that we can collectively call setElement(), load() and save()
 *         on them
 * 
 *         When we select another pad, call the setElement() method to
 *         update the view
 */
private Component makeSampleArea(final Pad pad) {
	final int samplesNb = pad.getLayerNumber();
	final SamplePanel layersArea = new SamplePanel(pad, new GridLayout(2, 2, 10, 10));
	for (int i = 0; i < samplesNb && i < 4; i++) {
		final Layer layer = pad.getLayer(i);
		final int layerIndex = i;
		final WidgetPanel area = new WidgetPanel(layer) {

			public void make() {
				final String layerLabel = "Sample Layer " + (layerIndex + 1);
				final JLabel title = new JLabel(layerLabel, JLabel.CENTER);
				title.setFont(FONT);
				add(title);
				setLayout(new GridLayout(7, 1, 5, 0));
				super.makeParameters();

				// play/remove buttons
				final JPanel layerButtons = new JPanel(new FlowLayout(2, 0, 0));
				final JButton playButton = new JButton("Play");
				playButton.setFont(MEDIUM_FONT);
				layerButtons.add(playButton);
				final JButton removeButton = new JButton("Clear");
				removeButton.setFont(MEDIUM_FONT);
				layerButtons.add(removeButton);
				final ActionListener actionListener = new ActionListener() {

					public void actionPerformed(ActionEvent e) {
						final Object source = e.getSource();
						if (source == playButton) {
							samples.play(layer);
						} else if (source == removeButton) {
							samples.remove(layer);
							refreshPadButton(pad);
							load();
						}
					}

				};
				playButton.addActionListener(actionListener);
				removeButton.addActionListener(actionListener);
				add(layerButtons);
			}

			public void makeDecimalParameter(Parameter parameter) {
				if (parameter.getLabel().startsWith("Tuning")) {
					final Widget.TuningField widget = new Widget.TuningField((Layer) getElement(), parameter);
					addWidget(widget);
				}
			}

		};
		layersArea.add(area);
		area.make();
	}
	return layersArea;
}
 
Example 20
/**
 * Sets an initial <code>value</code> for the editor.  This will cause the editor to <code>stopEditing</code>
 * and lose any partially edited value if the editor is editing when this method is called. <p>
 * <p>
 * Returns the component that should be added to the client's <code>Component</code> hierarchy.  Once installed
 * in the client's hierarchy this component will then be able to draw and receive user input.
 *
 * @param table      the <code>JTable</code> that is asking the editor to edit; can be <code>null</code>
 * @param value      the value of the cell to be edited; it is up to the specific editor to interpret and draw the
 *                   value.  For example, if value is the string "true", it could be rendered as a string or it could be rendered
 *                   as a check box that is checked.  <code>null</code> is a valid value
 * @param isSelected true if the cell is to be rendered with highlighting
 * @param row        the row of the cell being edited
 * @param column     the column of the cell being edited
 * @return the component for editing
 */
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
                                             int column) {
    final JPanel renderPanel = new JPanel(new BorderLayout());
    final DefaultTableCellRenderer defaultRenderer = new DefaultTableCellRenderer();
    final Component label = defaultRenderer.getTableCellRendererComponent(table, value, isSelected,
                                                                          false, row, column);
    renderPanel.add(label);
    renderPanel.add(button, BorderLayout.EAST);
    this.value[0] = (String) value;
    return renderPanel;
}