本文整理了Java中javax.swing.JTable.setPreferredScrollableViewportSize()
方法的一些代码示例,展示了JTable.setPreferredScrollableViewportSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.setPreferredScrollableViewportSize()
方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:setPreferredScrollableViewportSize
暂无
代码示例来源:origin: stackoverflow.com
table.setPreferredScrollableViewportSize(table.getPreferredSize());
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setVisible(true);
代码示例来源:origin: wiztools/rest-client
JTable jt = new JTable(tm_failures);
Dimension d = jt.getPreferredSize();
d.height = d.height / 2;
jt.setPreferredScrollableViewportSize(d);
jsp_jt_failures = new JScrollPane(jt);
jtp.add("Failures", jsp_jt_failures);
JTable jt = new JTable(tm_errors);
Dimension d = jt.getPreferredSize();
d.height = d.height / 2;
jt.setPreferredScrollableViewportSize(d);
jsp_jt_errors = new JScrollPane(jt);
jtp.add("Errors", jsp_jt_errors);
jsp_jta_trace = new JScrollPane(jta_trace);
jtp.add("Trace", jsp_jta_trace);
代码示例来源:origin: wildfly/wildfly
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
table.setPreferredScrollableViewportSize(new Dimension(500, 200));
add(new JScrollPane(table));
代码示例来源:origin: stackoverflow.com
JTable table = new JTable(data, columns);
JScrollPane scroll = new JScrollPane(table);
table.setPreferredScrollableViewportSize(table.getPreferredSize());
p.add(scroll, BorderLayout.CENTER);
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Creates the attribute selection panel with no initial instances.
*/
public AttributeListPanel() {
m_Table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
m_Table.setColumnSelectionAllowed(false);
m_Table.setPreferredScrollableViewportSize(new Dimension(250, 150));
setLayout(new BorderLayout());
add(new JScrollPane(m_Table), BorderLayout.CENTER);
}
代码示例来源:origin: stackoverflow.com
table.setPreferredScrollableViewportSize(table.getPreferredSize());
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane);
public void run() {
TableCheckBox frame = new TableCheckBox();
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.pack();
frame.setLocation(150, 150);
frame.setVisible(true);
代码示例来源:origin: wiztools/rest-client
final JTable jt = new JTable();
jt.setPreferredScrollableViewportSize(d);
tableDimension = d;
JScrollPane jsp = new JScrollPane(jt);
jp_center.add(jsp);
jp.add(jp_center, BorderLayout.CENTER);
代码示例来源:origin: Waikato/weka-trunk
/**
* Creates the attribute selection panel with no initial instances.
*/
public AttributeListPanel() {
m_Table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
m_Table.setColumnSelectionAllowed(false);
m_Table.setPreferredScrollableViewportSize(new Dimension(250, 150));
setLayout(new BorderLayout());
add(new JScrollPane(m_Table), BorderLayout.CENTER);
}
代码示例来源:origin: stackoverflow.com
private JTable table = new JTable(model);
table.setPreferredScrollableViewportSize(new Dimension(320, 160));
TableColumn tc = table.getColumnModel().getColumn(BOOLEAN_COL);
tc.setHeaderRenderer(new SelectAllHeader(table, BOOLEAN_COL));
JFrame f = new JFrame();
f.add(new JScrollPane(table));
f.pack();
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
代码示例来源:origin: apache/felix
public OsgiProbesTabUI(){
this.innerTable=new JTable();
this.innerTable.setPreferredScrollableViewportSize(new java.awt.Dimension(500,150));
JScrollPane table = new JScrollPane(this.innerTable);
this.add(table);
}
代码示例来源:origin: robo-code/robocode
/**
* Return the scroll pane
*
* @return JScrollPane
*/
protected JScrollPane getScrollPane() {
if (scrollPane == null) {
scrollPane = new JScrollPane();
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE);
scrollPane.setViewportView(getTable());
scrollPane.setColumnHeaderView(table.getTableHeader());
scrollPane.addComponentListener(eventHandler);
tableSize = new Dimension(getTable().getColumnModel().getTotalColumnWidth(),
getTable().getModel().getRowCount() * (getTable().getRowHeight()));
table.setPreferredScrollableViewportSize(tableSize);
table.setPreferredSize(tableSize);
table.setMinimumSize(tableSize);
}
return scrollPane;
}
代码示例来源:origin: stackoverflow.com
popup.add( menuItem );
JTable table = new JTable(50, 5);
table.addMouseListener( new MouseAdapter()
table.setPreferredScrollableViewportSize(table.getPreferredSize());
getContentPane().add( new JScrollPane(table) );
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible( true );
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
protected JPanel createEditorPanel() {
table = new JTable();
table.setRowHeight(25);
table.setRowMargin(3);
table.setPreferredScrollableViewportSize(TABLE_DIM);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JScrollPane(table), BorderLayout.CENTER);
return panel;
}
代码示例来源:origin: ribomation/DroidAtScreen1
@Override
protected void doExecute(Application app, DeviceFrame target) {
Map<String, String> properties = target.getDevice().getProperties();
final String toolTipText = "Click on a row to view the complete property value";
PropertiesModel model = new PropertiesModel(properties);
JTable tbl = new JTable(model) {
@Override
public String getToolTipText(MouseEvent event) {
return toolTipText;
}
};
tbl.getTableHeader().setToolTipText(toolTipText);
tbl.setRowSelectionAllowed(true);
tbl.getSelectionModel().addListSelectionListener(model);
tbl.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
tbl.setShowHorizontalLines(true);
tbl.setFillsViewportHeight(true);
tbl.setPreferredScrollableViewportSize(new Dimension(400, 200));
JScrollPane pane = new JScrollPane(tbl);
JOptionPane.showMessageDialog(app.getAppFrame(), pane, "Device Properties", JOptionPane.PLAIN_MESSAGE);
}
代码示例来源:origin: stackoverflow.com
table.setPreferredScrollableViewportSize(table.getPreferredSize());
table.setAutoCreateRowSorter(true);
sorter.sort();
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
import java.util.List;
import javax.swing.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
public class UserListDemo {
public static void main(String[] args) throws Exception {
String jsonUsers =
"["
+ "{ \"firstName\": \"Stack\", \"lastName\": \"Overflow\" },"
+ "{ \"firstName\": \"Pee\", \"lastName\": \"Skillet\" }"
+"]";
ObjectMapper mapper = new ObjectMapper();
List<User> users = mapper.readValue(
jsonUsers,
TypeFactory.defaultInstance().constructCollectionType(
List.class, User.class));
UserTableModel model = new UserTableModel(users);
JTable table = new JTable(model);
table.setPreferredScrollableViewportSize(table.getPreferredSize());
JOptionPane.showMessageDialog(null, new JScrollPane(table));
}
}
代码示例来源:origin: stackoverflow.com
table.setPreferredScrollableViewportSize(table.getPreferredSize());
scrollPane = new JScrollPane(table);
frame.add(scrollPane);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
public JPanel createDnsServersTablePanel() {
// create the JTable that holds header per row
dnsServersTable = new JTable(dnsServersTableModel);
JMeterUtils.applyHiDPI(dnsServersTable);
dnsServersTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
dnsServersTable.setPreferredScrollableViewportSize(new Dimension(400, 100));
JPanel panel = new JPanel(new BorderLayout(0, 5));
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("dns_servers"))); // $NON-NLS-1$
JScrollPane dnsServScrollPane = new JScrollPane(dnsServersTable);
panel.add(dnsServScrollPane, BorderLayout.CENTER);
dnsServButPanel = createButtonPanel();
panel.add(dnsServButPanel, BorderLayout.SOUTH);
return panel;
}
代码示例来源:origin: stackoverflow.com
{"dev", "6", "dir", "Jul 12", "drwxr-xr-x"},
{"etc", "34", "dir", "Jul 12", "drwxr-xr-x"},};
JTable table = new JTable(data, columnNames);
table.setPreferredScrollableViewportSize(table.getPreferredSize());
JScrollPane scrollPane = new JScrollPane(table);
final TableColumnHider hider = new TableColumnHider(table);
JPanel checkBoxes = new JPanel();
checkBoxes.add(checkBox);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(scrollPane);
frame.getContentPane().add(checkBoxes, BorderLayout.SOUTH);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
public JPanel createDnsHostsTablePanel() {
// create the JTable that holds header per row
dnsHostsTable = new JTable(dnsHostsTableModel);
JMeterUtils.applyHiDPI(dnsHostsTable);
dnsHostsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
dnsHostsTable.setPreferredScrollableViewportSize(new Dimension(400, 100));
JPanel panel = new JPanel(new BorderLayout(0, 5));
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("dns_hosts"))); // $NON-NLS-1$
JScrollPane dnsHostsScrollPane = new JScrollPane(dnsHostsTable);
panel.add(dnsHostsScrollPane, BorderLayout.CENTER);
dnsHostsButPanel = createHostsButtonPanel();
panel.add(dnsHostsButPanel, BorderLayout.SOUTH);
return panel;
}
内容来源于网络,如有侵权,请联系作者删除!