Java Code Examples for javax.swing.JTable#setMinimumSize()

The following examples show how to use javax.swing.JTable#setMinimumSize() . 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
Source File: MainView.java    From HiJson with Apache License 2.0 5 votes vote down vote up
private JTable newTable(){
    String col[] ={"key","value"};
    DefaultTableModel tm = new DefaultTableModel();
    tm.setColumnCount(2);
    tm.setColumnIdentifiers(col);
    JTable table = new JTable(tm);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setAutoscrolls(true);
    table.setMinimumSize(new Dimension(160, 100));
    return table;
}
 
Example 2
Source File: MergeResultsGui.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
private JTable createGrid() {
    grid = new JTable();
    grid.getDefaultEditor(String.class).addCellEditorListener(this);
    createTableModel();
    grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    grid.setMinimumSize(new Dimension(200, 100));

    return grid;
}
 
Example 3
Source File: PageDataExtractorOverTimeGui.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
private JTable createGrid() {
    grid = new JTable();
    createTableModel();
    grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    grid.setMinimumSize(new Dimension(200, 100));
    grid.getColumnModel().getColumn(0).setPreferredWidth(350);
    grid.getColumnModel().getColumn(1).setPreferredWidth(350);
    grid.getColumnModel().getColumn(2).setPreferredWidth(50);
    grid.getColumnModel().getColumn(3).setPreferredWidth(110);

    return grid;
}
 
Example 4
Source File: PerfMonGui.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
private JTable createGrid() {
    grid = new JTable();
    createTableModel();
    grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    grid.setMinimumSize(new Dimension(200, 100));

    grid.getColumnModel().getColumn(0).setPreferredWidth(170);
    grid.getColumnModel().getColumn(1).setPreferredWidth(80);
    grid.getColumnModel().getColumn(2).setPreferredWidth(120);
    grid.getColumnModel().getColumn(3).setPreferredWidth(500);

    return grid;
}
 
Example 5
Source File: VariableThroughputTimerGui.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
private JTable createGrid() {
    grid = new JTable();
    grid.getDefaultEditor(String.class).addCellEditorListener(this);
    createTableModel();
    grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    grid.setMinimumSize(new Dimension(200, 100));
    return grid;
}
 
Example 6
Source File: IsotopePatternPreviewDialog.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void addDialogComponents() {
  super.addDialogComponents();

  pFormula = parameterSet.getParameter(IsotopePatternPreviewParameters.formula);
  pMinIntensity = parameterSet.getParameter(IsotopePatternPreviewParameters.minIntensity);
  pMergeWidth = parameterSet.getParameter(IsotopePatternPreviewParameters.mergeWidth);
  pCharge = parameterSet.getParameter(IsotopePatternPreviewParameters.charge);

  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

  cmpMinIntensity =
      (PercentComponent) getComponentForParameter(IsotopePatternPreviewParameters.minIntensity);
  cmpMergeWidth =
      (DoubleComponent) getComponentForParameter(IsotopePatternPreviewParameters.mergeWidth);
  cmpCharge = (IntegerComponent) getComponentForParameter(IsotopePatternPreviewParameters.charge);
  cmpFormula =
      (StringComponent) getComponentForParameter(IsotopePatternPreviewParameters.formula);

  // panels
  newMainPanel = new JPanel(new BorderLayout());
  pnText = new JScrollPane();
  pnlChart = new EChartPanel(chart);
  pnSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, pnlChart, pnText);
  table = new JTable();
  pnlParameters = new JPanel(new FlowLayout());
  pnlControl = new JPanel(new BorderLayout());

  pnText.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  pnText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

  pnText.setMinimumSize(new Dimension(350, 300));
  pnlChart.setMinimumSize(new Dimension(350, 200));
  pnlChart.setPreferredSize( // TODO: can you do this cleaner?
      new Dimension((int) (screenSize.getWidth() / 3), (int) (screenSize.getHeight() / 3)));
  table.setMinimumSize(new Dimension(350, 300));
  table.setDefaultEditor(Object.class, null);

  // controls
  ttGen = new SpectraToolTipGenerator();
  theme = new EIsotopePatternChartTheme();
  theme.initialize();

  // reorganize
  getContentPane().remove(mainPanel);
  organizeParameterPanel();
  pnlControl.add(pnlParameters, BorderLayout.CENTER);
  pnlControl.add(pnlButtons, BorderLayout.SOUTH);
  newMainPanel.add(pnSplit, BorderLayout.CENTER);
  newMainPanel.add(pnlControl, BorderLayout.SOUTH);
  getContentPane().add(newMainPanel);
  pnlButtons.remove(super.btnCancel);

  chart = ChartFactory.createXYBarChart("Isotope pattern preview", "m/z", false, "Abundance",
      new XYSeriesCollection(new XYSeries("")));
  pnlChart.setChart(chart);
  pnText.setViewportView(table);

  updateMinimumSize();
  pack();
}