本文整理汇总了Java中javax.swing.JScrollPane.setViewportView方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.setViewportView方法的具体用法?Java JScrollPane.setViewportView怎么用?Java JScrollPane.setViewportView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.setViewportView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ListPanel
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public ListPanel(FilterModel fltrmodel, Function<T, String> mapper) {
setLayout(new java.awt.BorderLayout());
JScrollPane sp = new javax.swing.JScrollPane();
list = new JList();
list.setModel(fltrmodel);
list.setCellRenderer(new CheckBoxListRenderer(mapper));
sp.setViewportView(list);
add(sp, BorderLayout.CENTER);
list.setSelectionModel(new MultiSelectionModel(this::onSelect));
list.addKeyListener(onDelete());
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ctrl A"), "SelectAll");
list.getActionMap().put("SelectAll", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent ae) {
list.setSelectionInterval(0, list.getModel().getSize() - 1);
}
});
}
示例2: createAndShowGUI
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private static void createAndShowGUI() {
frame = new JFrame();
final JScrollPane jScrollPane1 = new JScrollPane();
ta = new JTextArea();
ta.setEditable(false);
ta.setColumns(20);
ta.setRows(5);
jScrollPane1.setViewportView(ta);
frame.add(ta);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
示例3: erzeugeMedienAnzeiger
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Erzeugt das Panel in dem die Mediendetails angezeigt werden.
*/
private void erzeugeMedienAnzeiger()
{
JScrollPane medienAnzeigerScrollPane = new JScrollPane();
medienAnzeigerScrollPane.setPreferredSize(new Dimension(-1, 160));
medienAnzeigerScrollPane.setSize(-1, -1);
medienAnzeigerScrollPane.setBorder(BorderFactory.createTitledBorder(
null, "Ausgewählte Medien", TitledBorder.LEADING,
TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
medienAnzeigerScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
medienAnzeigerScrollPane.getVerticalScrollBar()
.setBackground(UIConstants.BACKGROUND_COLOR);
medienAnzeigerScrollPane.getHorizontalScrollBar()
.setBackground(UIConstants.BACKGROUND_COLOR);
_medienAnzeigerTextArea = new JTextArea();
_medienAnzeigerTextArea.setBackground(UIConstants.BACKGROUND_COLOR);
medienAnzeigerScrollPane.setViewportView(_medienAnzeigerTextArea);
_medienAnzeigerTextArea.setEditable(false);
_medienAnzeigerTextArea.setFont(UIConstants.TEXT_FONT);
_hauptPanel.add(medienAnzeigerScrollPane, BorderLayout.CENTER);
}
示例4: createColumnViewArea
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private JScrollPane createColumnViewArea()
{
JScrollPane scroll_colEdit = new JScrollPane();
scroll_colEdit.setViewportView(m_tblColView);
scroll_colEdit.setBounds(m_scrollTblName.getWidth() + GuiConstants.GAP_COMPONENT, m_nYOffsetInRightPane,
s_nRightPaneWidth, 300);
m_nYOffsetInRightPane += (scroll_colEdit.getHeight() + GuiConstants.GAP_COMPONENT);
return scroll_colEdit;
}
示例5: createUserPanel
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private JComponent createUserPanel() {
JScrollPane pane = new JScrollPane();
userTable = new JTable(userModel) {
/**
*
*/
private static final long serialVersionUID = 2660594023797090389L;
public void changeSelection(int rowIndex, int columnIndex,
boolean toggle, boolean extend) {
super.changeSelection(rowIndex, columnIndex, toggle, extend);
groupModel.fireTableDataChanged();
qualifierModel.fireTableDataChanged();
deleteUser.setEnabled(rowIndex >= 0);
editUser.setEnabled(rowIndex >= 0);
}
};
pane.setViewportView(userTable);
return pane;
}
示例6: TextPanel
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Create the panel.
*/
public TextPanel(String text) {
JLabel lblUpdateChangelog = new JLabel("Update description/change-log:");
JScrollPane scrollPane = new JScrollPane();
JLabel lblDoYouWant = new JLabel("Do you want to install this update?");
lblDoYouWant.setFont(new Font("Tahoma", Font.PLAIN, 15));
lblDoYouWant.setHorizontalAlignment(SwingConstants.CENTER);
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
.addComponent(lblUpdateChangelog, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
.addComponent(lblDoYouWant, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE))
.addContainerGap())
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lblUpdateChangelog)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblDoYouWant)
.addContainerGap())
);
JTextArea textArea = new JTextArea();
scrollPane.setViewportView(textArea);
setLayout(groupLayout);
textArea.setEditable(false);
textArea.setText(text);
}
示例7: createTable
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private Component createTable() {
JScrollPane pane = new JScrollPane();
tableModel = new Model();
table = new JTable(tableModel);
pane.setViewportView(table);
return pane;
}
示例8: erzeugeVerleihkartenauflister
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Erzeuge das Tabellen-Panel, in dem die Verleihkarten angezeigt werden.
*/
private void erzeugeVerleihkartenauflister()
{
JPanel verleihkartenAuflisterPanel = new JPanel();
_hauptPanel.add(verleihkartenAuflisterPanel, BorderLayout.CENTER);
verleihkartenAuflisterPanel.setLayout(new BorderLayout());
verleihkartenAuflisterPanel
.setPreferredSize(new java.awt.Dimension(-1, -1));
verleihkartenAuflisterPanel.setSize(-1, -1);
verleihkartenAuflisterPanel.setBackground(UIConstants.BACKGROUND_COLOR);
JScrollPane verleihkartenAuflisterScrollPane = new JScrollPane();
verleihkartenAuflisterPanel.add(verleihkartenAuflisterScrollPane,
BorderLayout.CENTER);
verleihkartenAuflisterScrollPane
.setPreferredSize(new java.awt.Dimension(-1, -1));
verleihkartenAuflisterScrollPane.setSize(-1, -1);
verleihkartenAuflisterScrollPane.setBorder(BorderFactory
.createTitledBorder(null, "Verleihkarten", TitledBorder.LEADING,
TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
verleihkartenAuflisterScrollPane
.setBackground(UIConstants.BACKGROUND_COLOR);
verleihkartenAuflisterScrollPane.getVerticalScrollBar()
.setBackground(UIConstants.BACKGROUND_COLOR);
verleihkartenAuflisterScrollPane.getHorizontalScrollBar()
.setBackground(UIConstants.BACKGROUND_COLOR);
_verleihkartenAuflisterTableModel = new VerleihkartenTableModel();
_verleihkartenAuflisterTable = new JTable();
verleihkartenAuflisterScrollPane
.setViewportView(_verleihkartenAuflisterTable);
_verleihkartenAuflisterTable
.setModel(_verleihkartenAuflisterTableModel);
JTableHeader tableHeader = _verleihkartenAuflisterTable
.getTableHeader();
tableHeader.setFont(UIConstants.HEADER_FONT);
tableHeader.setReorderingAllowed(false);
tableHeader.setResizingAllowed(false);
_verleihkartenAuflisterTable.setFont(UIConstants.TEXT_FONT);
}
示例9: loadScene
import javax.swing.JScrollPane; //导入方法依赖的package包/类
@Override
public void loadScene(Container container) {
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 0, 784, 461);
container.add(scrollPane);
JTextPane textPane = new JTextPane();
textPane.setFont(new Font("Tahoma", Font.PLAIN, 12));
for (int i = 0; i < 50; i++) {
textPane.setText(textPane.getText() + "\n" + i);
}
scrollPane.setViewportView(textPane);
}
示例10: deleteElements
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public static boolean deleteElements(DeleteStatusList list,
JComponent component, GUIFramework framework) {
final JLabel label = new JLabel(toMessage(list, framework));
final JScrollPane pane = new JScrollPane();
pane.setBorder(null);
pane.setViewportView(label);
final Dimension d = label.getPreferredSize();
final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
boolean b = false;
if (d.width >= screen.width * 0.7) {
d.width = (int) (screen.width * 0.7);
b = true;
} else
d.width += 20;
if (d.height >= screen.height / 2) {
d.height = screen.height / 2;
b = true;
} else
d.height += 20;
if (b)
pane.setPreferredSize(d);
int r = JOptionPane.showOptionDialog(component, new Object[]{
pane,
new JLabel(GlobalResourcesManager
.getString("DeleteActiveElementsDialog.Warning"))},
GlobalResourcesManager.getString("ConfirmMessage.Title"),
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
null, null);
if (JOptionPane.YES_OPTION == r) {
return true;
}
return false;
}
示例11: SelectBaseFunctionDialog
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public SelectBaseFunctionDialog(GUIFramework framework) {
super(framework.getMainFrame(), true);
setTitle(GlobalResourcesManager.getString("SelectModel"));
result = null;
final List<Qualifier> base = IDEF0Plugin.getBaseQualifiers(framework
.getEngine());
Collections.sort(base, new Comparator<Qualifier>() {
private Collator collator = Collator.getInstance();
@Override
public int compare(Qualifier o1, Qualifier o2) {
return collator.compare(o1.getName(), o2.getName());
}
});
list.setModel(new AbstractListModel() {
@Override
public Object getElementAt(int index) {
return base.get(index);
}
@Override
public int getSize() {
return base.size();
}
});
JScrollPane pane = new JScrollPane();
pane.setViewportView(list);
setMainPane(pane);
pack();
setMinimumSize(getSize());
setLocationRelativeTo(null);
Options.loadOptions(this);
}
示例12: TypeWizard
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Create the frame.
*/
public TypeWizard(final Graph graph, final Object onWhat, final List<Object> list) {
this.graph = graph;
this.onWhat = onWhat;
this.setTitle("Change Atom Type Wizard");
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setBounds(100, 100, 450, 300);
this.getContentPane().setLayout(new BorderLayout(0, 0));
final JScrollPane scrollPane = new JScrollPane();
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
this.list = new JList<Object>();
this.list.setFont(new Font("Times New Roman", Font.PLAIN, 12));
this.list.setBorder(new LineBorder(new Color(0, 0, 0)));
this.list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
this.list.setModel(new TypeListModel(list));
scrollPane.setViewportView(this.list);
final JPanel buttonPanel = new JPanel();
this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
buttonPanel.setLayout(new BorderLayout(0, 0));
this.finishButton = new JButton("Finish");
this.finishButton.setFont(new Font("Times New Roman", Font.PLAIN, 12));
this.finishButton.setMnemonic('F');
buttonPanel.add(this.finishButton, BorderLayout.EAST);
this.finishButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent arg) {
TypeWizard.this.performFinish();
GraphUtil.getInstance().layout();
TypeWizard.this.dispose();
}
});
}
示例13: Ouners
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public Ouners() {
setLayout(new BorderLayout());
final JScrollPane pane = new JScrollPane();
final JTable table = new JTable(model);
pane.setViewportView(table);
this.add(pane, BorderLayout.CENTER);
}
示例14: createGUIPluginListComponent
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private Component createGUIPluginListComponent() {
JScrollPane pane = new JScrollPane();
Object[][] data = new Object[guiPlugins.size()][];
for (int i = 0; i < guiPlugins.size(); i++) {
GUIPlugin plugin = guiPlugins.get(i);
String name = plugin.getName();
if (plugin instanceof com.ramussoft.gui.common.AttributePlugin)
name = "Attribute."
+ name
+ "."
+ ((com.ramussoft.gui.common.AttributePlugin) plugin)
.getAttributeType().getTypeName();
data[i] = new Object[]{name};
}
Arrays.sort(data, new Comparator<Object[]>() {
@SuppressWarnings("unchecked")
@Override
public int compare(Object[] o1, Object[] o2) {
return ((Comparable<String>) o1[0]).compareTo((String) o2[0]);
}
});
DefaultTableModel model = new DefaultTableModel(
data,
new Object[]{GlobalResourcesManager.getString("Plugin.Name")}) {
/**
*
*/
private static final long serialVersionUID = 4893341040484525590L;
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
pane.setViewportView(new JTable(model));
return pane;
}
示例15: RecogApp
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public RecogApp()
{
super("Card Recognizer");
BorderLayout bl = new BorderLayout();
setLayout(bl);
list = new RecogList();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Webcam w = WebcamUtils.chooseWebcam();
JPanel right = new JPanel();
right.setLayout(new GridLayout(2,1));
wc = new WebcamCanvas(w);
JScrollPane scroll = new JScrollPane();
select = new SetLoadPanel(list);
scroll.setViewportView(select);
add(wc,BorderLayout.CENTER);
add(right,BorderLayout.EAST);
right.add(new SettingsPanel());
right.add(scroll);
right.setPreferredSize(new Dimension(300,wc.getHeight()));
pack();
setVisible(true);
setResizable(false);
try{
w.open();
}catch(WebcamLockException e)
{
JOptionPane.showMessageDialog(null, "Webcam already in use. Exiting.");
System.exit(0);
}
wc.getCanvas().addKeyListener(this);
while(true)
{
wc.draw();
if(SettingsPanel.RECOG_EVERY_FRAME)
{
doRecog();
}
}
}