本文整理了Java中javax.swing.JScrollPane.add()
方法的一些代码示例,展示了JScrollPane.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.add()
方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:add
暂无
代码示例来源:origin: org.netbeans.api/org-openide-explorer
@Override
public void add(Component comp, Object constraints) {
if (constraints == searchConstraints) {
searchPanel = comp;
constraints = null;
}
super.add(comp, constraints);
}
代码示例来源:origin: org.netbeans.api/org-openide-explorer
@Override
public void add(Component comp, Object constraints) {
if (constraints == searchConstraints) {
searchPanel = comp;
constraints = null;
}
super.add(comp, constraints);
}
代码示例来源:origin: stackoverflow.com
// Problem #1...
JScrollPane pane = new JScrollPane();
pane.add(buttonPanel);
//...
// Problem #2...
panel.add(pane);
frame.add(panel);
代码示例来源:origin: stackoverflow.com
JScrollPane scrollPane = new JScrollPane();
scrollPane.add( panel );
代码示例来源:origin: stackoverflow.com
JScrollPane jps = new JScrollPane();
jps.add(table);
代码示例来源:origin: stackoverflow.com
JScrollPane scrollPane = new JScrollPane();
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane.add(cSoftware);
panel.add(scrollPane);
//add buttons etc
代码示例来源:origin: stackoverflow.com
JScrollPane s = new JScrollPane();
JPanel p = new JPanel();
s.add(p);
代码示例来源:origin: stackoverflow.com
JLabel[] pics = // Put pictures into labels
JPanel panel = new JPanel();
panel.setLayoutManager(/* FlowLayout if the pics are the same size; GridLayout otherwise? */);
for (JLabel pic : pics) {
panel.add(pic);
}
JScrollPane scroll = new JScrollPane();
scroll.add(panel);
// Disable the vertical scrollbar
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
代码示例来源:origin: stackoverflow.com
JScrollPane scrollPane = new JScrollPane();
JTextArea textArea = new JTextArea();
scrollPane.add(textArea);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
代码示例来源:origin: stackoverflow.com
public class test
{
private static JFrame frame = new JFrame();
private static JTabbedPane pane0 = new JTabbedPane();
private static JScrollPane pane1 = new JScrollPane();
private static JPanel pane2 = new JPanel();
//add the rest of your JPanels here
public static void main(String[] args)
{
frame.setSize(400,400);
//add all the other attributes here
frame.add(pane0);
pane0.add(pane1);
pane1.add(pane2);
//go ahead and add the rest of your panels here
frame.pack();//resizes the frame so that its subcomponents fit well inside.
}
}//this last bracket is for the class itself. Sorry i couldn't tab everything the right //way.
代码示例来源:origin: stackoverflow.com
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setBounds(446, 50, 397, 490);
tabbedPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
tabbedPane.setFont(new Font("Carlito", Font.PLAIN, 13));
tabbedPane.setBackground(Color.WHITE);
frame.getContentPane().add(tabbedPane); // JFrame
tableMainTest = new JTable();
tableMainTest.setName("tableMainTest");
tableMainTest.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tableMainTest.setFont(new Font("Carlito", Font.PLAIN, 13));
tableMainTest.setFocusable(false);
tableMainTest.setModel(tableModel);
tableMainTest.setPreferredScrollableViewportSize(tableMainTest.getPreferredSize());
tableMainTest.changeSelection(0, 0, false, false);
tableMainTest.setAutoCreateRowSorter(true);
JScrollPane scrollMain = new JScrollPane(tableMainTest);
scrollMain.add(tableMainTest.getTableHeader());
scrollMain.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER );
scrollMain.setBounds(446, 50, 397, 490);
tabbedPane.addTab(descrTableMain, scrollMain);
代码示例来源:origin: de.uni_leipzig.asv.toolbox/toolbox-utils
public void addData(Vector data) {
int actDatum = 0;
String rows[][] = new String[data.size()][columns];
Iterator it = data.iterator();
while (it.hasNext()) {
String[] o = (String[]) it.next();
int l = o.length;
for (int i = 0; i < l; i++) {
rows[actDatum][i] = o[i];
}
actDatum += 1;
}
DefaultTableModel model = new DefaultTableModel(rows, this.header);
tableSorter = new TableSorter(model);
commonTable = new JTable(tableSorter);
tableSorter.setTableHeader(commonTable.getTableHeader());
commonTable.getColumnModel().getColumn(0).setWidth(this.columnWidth);
jScrollPane.add(commonTable, null);
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
public void cmdToBar(JScrollPane scrollPane, JInternalFrame cmdFrame) {
desktop.remove(cmdFrame);
cmdFrame.dispose();
scrollPane.getViewport().setMaximumSize(new Dimension(frame.getSize().width, 35));
scrollPane.getViewport().setPreferredSize(new Dimension(frame.getSize().width, 35));
frame.add(scrollPane, BorderLayout.PAGE_END);
desktop.updateUI();
}
代码示例来源:origin: stackoverflow.com
JTree tree;
JScrollPane scrollPane;
DefaultMutableTreeNode root = new DefaultMutableTreeNode("RootNode");
public Tree()
{
setVisible(true);
setSize(100, 300);
createChildNodes(root);
tree = new JTree(root);
tree.setVisible(true);
tree.setSize(100, 300);
scrollPane = new JScrollPane(tree);
scrollPane.add(tree);
scrollPane.setVisible(true);
scrollPane.setSize(100, 300);
scrollPane.setViewportView(this);
scrollPane.setBackground(Color.red);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
protected void updateColumnHeader(PropertyChangeEvent e)
{
JViewport newColHead = (JViewport)(e.getNewValue());
if (newColHead != null) {
JViewport viewport = scrollpane.getViewport();
Point p = newColHead.getViewPosition();
if (viewport == null) {
p.x = 0;
} else {
if (scrollpane.getComponentOrientation().isLeftToRight()) {
p.x = viewport.getViewPosition().x;
} else {
p.x = Math.max(0, viewport.getViewPosition().x);
}
}
newColHead.setViewPosition(p);
scrollpane.add(newColHead, COLUMN_HEADER);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
private void initTree() {
JTree tree = new JTree(getRootNode());
tree.setCellRenderer(new CheckBoxTreeRenderer());
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.putClientProperty("JTree.lineStyle", "Angled"); //NOI18N
NodeSelectionListener listener = new NodeSelectionListener(tree);
tree.addMouseListener(listener);
tree.addKeyListener(listener);
tree.expandRow(0);
tree.setShowsRootHandles(true);
tree.setSelectionRow(0);
initTree(tree);
scrollPane.add(tree);
scrollPane.setViewportView(tree);
}
代码示例来源:origin: de.uni_leipzig.asv.toolbox/toolbox-utils
public void deleteSelected() {
String[] delItem;
Vector v = this.getTableData();
int rowCount = commonTable.getSelectedRowCount();
int[] selectedRows = commonTable.getSelectedRows();
int columnCount = commonTable.getColumnCount();
for (int i = 0; i < rowCount; i++) {
delItem = new String[columnCount];
for (int j = 0; j < columnCount; j++) {
delItem[j] = new String();
delItem[j] = (String) commonTable
.getValueAt(selectedRows[i], j);
}
if (v.contains(delItem)) {
v.remove(delItem);
}
}
this.addData(v);
jScrollPane.add(commonTable, null);
jScrollPane.setVisible(true);
jScrollPane.repaint();
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
public ClassHierarchyPanel(boolean isView) {
initComponents();
if (!isView) {
toolBar.remove(0);
toolBar.remove(0);
subtypeButton.setFocusable(true);
supertypeButton.setFocusable(true);
}
setName(NbBundle.getMessage(getClass(), "CTL_ClassHierarchyTopComponent")); // NOI18N
setToolTipText(NbBundle.getMessage(getClass(), "HINT_ClassHierarchyTopComponent")); // NOI18N
tree = new JTree();
treeModel = new DefaultTreeModel(new DefaultMutableTreeNode());
tree.setModel(treeModel);
tree.setToggleClickCount(0);
tree.setCellRenderer(new TreeRenderer());
tree.putClientProperty("JTree.lineStyle", "Angled"); //NOI18N
tree.expandRow(0);
tree.setShowsRootHandles(true);
tree.setSelectionRow(0);
tree.setRootVisible(false);
hierarchyPane.add(tree);
hierarchyPane.setViewportView(tree);
tree.addMouseListener(mouseListener);
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
labels.configureToolBarButton(pButton, "view.toggleGrid.placard");
placardPanel.add(pButton, BorderLayout.EAST);
scrollPane.add(placardPanel, JScrollPane.LOWER_LEFT_CORNER);
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
labels.configureToolBarButton(pButton, "view.toggleGrid.placard");
placardPanel.add(pButton, BorderLayout.EAST);
scrollPane.add(placardPanel, JScrollPane.LOWER_LEFT_CORNER);
内容来源于网络,如有侵权,请联系作者删除!