javax.swing.JTable.setFillsViewportHeight()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(292)

本文整理了Java中javax.swing.JTable.setFillsViewportHeight()方法的一些代码示例,展示了JTable.setFillsViewportHeight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.setFillsViewportHeight()方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:setFillsViewportHeight

JTable.setFillsViewportHeight介绍

暂无

代码示例

代码示例来源:origin: apache/pdfbox

private void createView(JPanel headerPanel, JTable table)
{
  panel = new JPanel(new GridBagLayout());
  panel.setPreferredSize(new Dimension(300, 500));
  JScrollPane scrollPane = new JScrollPane(table);
  table.setFillsViewportHeight(true);
  scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.weighty = 0.05;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  gbc.anchor = GridBagConstraints.PAGE_START;
  panel.add(headerPanel, gbc);
  gbc.gridy = 2;
  gbc.weighty = 0.9;
  gbc.weightx = 1;
  gbc.fill = GridBagConstraints.BOTH;
  gbc.anchor = GridBagConstraints.BELOW_BASELINE;
  panel.add(scrollPane, gbc);
}

代码示例来源:origin: stackoverflow.com

JTable table = new JTable(new JTableModel()); 
   JScrollPane scrollPane = new JScrollPane(table);
   table.setFillsViewportHeight(true); 
   TableCellRenderer buttonRenderer = new JTableButtonRenderer();
   table.getColumn("Button1").setCellRenderer(buttonRenderer);
   table.getColumn("Button2").setCellRenderer(buttonRenderer);

代码示例来源:origin: apache/pdfbox

table.setFillsViewportHeight(true);
scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);

代码示例来源:origin: stackoverflow.com

table.setFillsViewportHeight(true);

代码示例来源:origin: stackoverflow.com

mainTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
mainTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
mainTable.setFillsViewportHeight(true);

代码示例来源:origin: stackoverflow.com

JTable table = new JTable(data, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
table.setFillsViewportHeight(true);
panel.add(scrollPane);

代码示例来源:origin: stackoverflow.com

JTable randomMatrix = new JTable(matrix, columns);
JScrollPane scrollpane = new JScrollPane(randomMatrix);

// This is very important
grid.add(scrollpane);

randomMatrix.setFillsViewportHeight(true);
grid.setSize(300, 300);
grid.setVisible(true);

代码示例来源:origin: stackoverflow.com

JPanel panel = new JPanel(new BorderLayout());
 String[] columnNames = {"A", "B", "C", "D", "E"};
 Object[][] data = new Object[20][columnNames.length];
 for (int i = 0; i < 20; i++) {
   data[i] = new Object[]{"Some other stuff that is long", "K", "1234567891011121314", "R", "T"};
 }
 JTable skillTable = new JTable(data, columnNames);
 skillTable.setFillsViewportHeight(true);
 JScrollPane scrollTable = new JScrollPane(skillTable);
 panel.add(scrollTable, BorderLayout.CENTER);
 //as you said you want to add a button as well
 JPanel buttonpanel=new JPanel();
 buttonpanel.add(new JButton("Test"));
 panel.add(buttonpanel,BorderLayout.SOUTH);

代码示例来源:origin: stackoverflow.com

JPanel tablePanel = new JPanel(new GridBagLayout());
GridBagConstraints layout= new GridBagConstraints();
JTable jtable = new JTable();
jtable.setPreferredScrollableViewportSize(new Dimension(500,50));
jtable.setFillsViewportHeight(true);
layout.fill = GridBagConstraints.BOTH;
layout.weightx = 1;
layout.weighty = 1;
layout.gridx = 0;
layout.insets = new Insets(10,10,10,10);
tablePanel.add(new JScrollPane(jtable), layout)

代码示例来源:origin: profesorfalken/jSensors

public GuiUpdater(JSensorsGUI jSensorsGUI) {
  JScrollPane scrollPane = new JScrollPane(table);
  table.setFillsViewportHeight(true);
  jSensorsGUI.add(scrollPane);
}

代码示例来源:origin: stackoverflow.com

public class TableDemo extends JPanel {
 private boolean DEBUG = true;
 private JTable table;
 public TableDemo() {
   super(new GridLayout(1,0));
   table = new JTable(new MyTableModel());
   table.setPreferredScrollableViewportSize(new Dimension(500, 70));
   table.setFillsViewportHeight(true);
   JScrollPane scrollPane = new JScrollPane(table);
   add(scrollPane);
 }
 // Rest of code

代码示例来源:origin: stackoverflow.com

JTable table = new JTable(data, columns);
table.setModel(model);
table.setBackground(Color.LIGHT_GRAY);
table.setForeground(Color.black);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
table.setFillsViewportHeight(true);

代码示例来源:origin: ribomation/DroidAtScreen1

private JComponent createDevicesTable() {
  JTable tbl = new JTable(app.getDeviceTableModel());
  tbl.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
  tbl.setRowSelectionAllowed(true);
  tbl.setShowHorizontalLines(true);
  tbl.setFillsViewportHeight(true);
  tbl.setPreferredScrollableViewportSize(new Dimension(450, 150));
  JScrollPane pane = new JScrollPane(tbl);
  pane.setBorder(BorderFactory.createTitledBorder("Devices"));
  return pane;
}

代码示例来源:origin: kaikramer/keystore-explorer

private JScrollPane wrapKeyStoreTableInScrollPane(JTable jtKeyStore) {
  jtKeyStore.setOpaque(true);
  jtKeyStore.setShowGrid(false);
  jtKeyStore.setFillsViewportHeight(true);
  JScrollPane jspKeyStoreTable = PlatformUtil.createScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
      ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
  jspKeyStoreTable.setViewportView(jtKeyStore);
  jspKeyStoreTable.setBorder(BorderFactory.createEtchedBorder());
  jspKeyStoreTable.setFocusable(false);
  return jspKeyStoreTable;
}

代码示例来源:origin: com.github.danielpacak.osgi.swingconsole/osgi.swingconsole

/**
 * Creates a {@code ServiceProperties} instance with empty properties.
 */
public ServiceProperties() {
  tableModel = new PropertiesTableModel();
  table = new JTable(tableModel);
  table.setName(TABLE_SERVICE_PROPERTIES_ID);
  tableContainer = new JScrollPane(table);
  table.setFillsViewportHeight(true);
  setLayout(new BorderLayout());
  add(tableContainer, BorderLayout.CENTER);
}

代码示例来源:origin: abc9070410/JComicDownloader

private void setRecordTable(JPanel textPanel) {
  recordTable = getRecordTable();//new JTable( new DataTable());
  //downTable.setPreferredScrollableViewportSize( new Dimension( 450, 120 ) );
  recordTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
  recordTable.setFillsViewportHeight(true);
  recordTable.setAutoCreateRowSorter(true);
  JScrollPane recordScrollPane = new JScrollPane(recordTable);
  //JPanel downPanel = new CommonGUI().getCenterPanel( downScrollPane );
  setRecordTableJPopupMenu(); // 設置右鍵彈出選單
  textPanel.add(recordScrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: eu.agrosense.client/mapping

private void init() {
  setLayout(new BorderLayout());
  //TODO: 
  //- to JXTable (sorting, column selection, ...)
  //- tableModel based on SourceRecords and AttributeDescriptors instead of String arrays.
  tableModel = new DefaultTableModel(src.getContents(), src.getColumnNames());
  table = new JTable(tableModel);
  JScrollPane scrollPane = new JScrollPane(table);
  table.setFillsViewportHeight(true);
  add(scrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: abc9070410/JComicDownloader

private void setBookmarkTable(JPanel textPanel) {
  bookmarkTable = getBookmarkTable();//new JTable( new DataTable());
  //downTable.setPreferredScrollableViewportSize( new Dimension( 450, 120 ) );
  bookmarkTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
  bookmarkTable.setFillsViewportHeight(true);
  bookmarkTable.setAutoCreateRowSorter(true);
  JScrollPane bookmarkScrollPane = new JScrollPane(bookmarkTable);
  //JPanel downPanel = new CommonGUI().getCenterPanel( downScrollPane );
  setBookmarkTableJPopupMenu(); // 設置右鍵彈出選單
  textPanel.add(bookmarkScrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

static public void makeTablePopupHandler(final JTable jTable) {
  jTable.setAutoCreateRowSorter(true);
  jTable.setFillsViewportHeight(true);
  TriggerMouseAdapter.installMouseAdapter(jTable);
  jTable.setColumnSelectionAllowed(false);
  TableModel tm = jTable.getModel();
  SafeJTable.setComponentRenderers(jTable, tm);
}

代码示例来源:origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

/**
 * Initialize JTable that contains namespaces
 */
private void initTable()
{
  namespaces = new JTable(new FilterTableModel());
  namespaces.removeColumn(namespaces.getColumn("#"));
  namespaces.setFillsViewportHeight(true);
  namespaces.setPreferredScrollableViewportSize(new Dimension(500, 70));
  // Create the scroll pane and add the table to it.
  JScrollPane scrollPane = new JScrollPane(namespaces);
  scrollPane.setBounds(70, 10, 300, 200);
  this.add(scrollPane);
}

相关文章

JTable类方法