本文整理汇总了Java中javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED属性的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED属性的具体用法?Java JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED怎么用?Java JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ReportPanel
/**
* Creates the basic FreeCol report panel.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param key A key for the title.
*/
public ReportPanel(FreeColClient freeColClient, String key) {
super(freeColClient, new MigLayout("wrap 1", "[fill]",
"[]30[fill]30[]"));
header = Utility.localizedHeader(Messages.nameKey(key), false);
add(header, "cell 0 0, align center");
reportPanel = new MigPanel("ReportPanelUI");
reportPanel.setOpaque(true);
reportPanel.setBorder(createBorder());
scrollPane = new JScrollPane(reportPanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.getVerticalScrollBar().setUnitIncrement( 16 );
add(scrollPane, SCROLL_PANE_SIZE);
add(okButton, "cell 0 2, tag ok");
float scale = getImageLibrary().getScaleFactor();
getGUI().restoreSavedSize(this, 200 + (int)(scale*850), 200 + (int)(scale*525));
}
示例2: QueryResultViewer
public QueryResultViewer() {
resultSet = null;
tableModel = new DefaultTableModel();
emptyResultLabel = new JLabel(EMPTY_RESULT_MSG);
mainContainer = new JPanel();
setLayout(new BorderLayout());
tableSP = new JScrollPane(graphicTable,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
tableSP.setBorder(BorderFactory.createEmptyBorder());
graphicTable.setModel(tableModel);
graphicTable.setFillsViewportHeight(true);
graphicTable.setEnabled(false);
addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
resizeColumnWidth(COL_MIN_WIDTH);
}
});
mainContainer.add(tableSP);
setLayout(new GridLayout(1,1));
add(tableSP);
}
示例3: MapEditorTransformPanel
/**
* Creates a panel to choose a map transform.
*
* @param freeColClient The {@code FreeColClient} for the game.
*/
public MapEditorTransformPanel(FreeColClient freeColClient) {
super(freeColClient, new BorderLayout());
nativeNation = first(getSpecification().getIndianNations());
listPanel = new JPanel(new GridLayout(2, 0));
group = new ButtonGroup();
//Add an invisible, move button to de-select all others
group.add(new JToggleButton());
buildList();
JScrollPane sl = new JScrollPane(listPanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
sl.getViewport().setOpaque(false);
add(sl);
}
示例4: initComponents
private void initComponents(URL ruleBase, String htmlDescription) {
setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
HTMLTextArea descriptionArea = new HTMLTextArea();
HTMLDocument hdoc = (HTMLDocument) descriptionArea.getDocument();
descriptionArea.setText(htmlDescription);
descriptionArea.setCaretPosition(0);
hdoc.setBase(ruleBase);
JScrollPane descriptionAreaScrollPane = new JScrollPane(descriptionArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
descriptionAreaScrollPane.setPreferredSize(new Dimension(375, 220));
add(descriptionAreaScrollPane, BorderLayout.CENTER);
}
示例5: init
private void init(JLabel label, String[] columns) {
tableModel = new PropertiesTableModel(columns);
tableModel.addTableModelListener(this);
table = new JTable(tableModel);
table.getTableHeader().setReorderingAllowed(false);
table.setDefaultRenderer(String.class, new PropertiesTableCellRenderer());
//table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor());
table.setRowHeight(table.getRowHeight());
table.addAncestorListener(this);
component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
component.setPreferredSize(new Dimension(340, 150));
table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PropertiesTable.class, "ACSD_PropertiesTable")); // NOI18N
table.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PropertiesTable.class, "ACSN_PropertiesTable")); // NOI18N
label.setLabelFor(table);
setColumns(columns);
}
示例6: CourseListPanel
/**
* Create the panel.
*/
public CourseListPanel(String user,ProfessorFrame pf) throws Exception{
setLayout(new BorderLayout(0, 0));
TableCellRenderer buttonRenderer = new ButtonRenderer();
dao = new ProfessorDAO();
model=new tableModelTeach(dao.getAllCourses(user),user,pf);
table = new JTable();
table.setRowHeight(30);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setDefaultRenderer(JButton.class,buttonRenderer);
table.addMouseListener(new JTableButtonMouseListener(table));
table.setModel(model);
JScrollPane scrollPane = new JScrollPane(table,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
//resizeColumnWidth(table);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
TableColumnModel tcm = table.getColumnModel();
tcm.getColumn(0).setPreferredWidth(800);
tcm.getColumn(1).setPreferredWidth(200);
scrollPane.setBounds(10, 57, 1320, 450);
add(scrollPane, BorderLayout.CENTER);
}
示例7: initComponents
private void initComponents() {
setLayout(new BorderLayout());
JPanel contentsPanel = new JPanel(new BorderLayout());
contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
contentsPanel.setOpaque(true);
contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));
headerArea = new HTMLTextArea() {
protected void showURL(URL url) {
String urlString = url.toString();
if (START_LOCATION_URLMASK.equals(urlString)) {
Utils.openLocation(StopwatchProfilingPoint.this.getStartLocation());
} else if (StopwatchProfilingPoint.this.usesEndLocation()) {
Utils.openLocation(StopwatchProfilingPoint.this.getEndLocation());
}
}
};
JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);
dataArea = new HTMLTextArea();
JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
TitledBorder tb = new TitledBorder(Bundle.StopwatchProfilingPoint_DataString());
tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
dataAreaScrollPane.setBorder(tb);
dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);
add(contentsPanel, BorderLayout.CENTER);
}
示例8: preparePanel
/**
* Load the panel.
*
* @param headerKey A message key for the panel title.
* @param ui The {@code OptionGroupUI} to encapsulate.
*/
private void preparePanel(String headerKey, OptionGroupUI ui) {
this.optionPanel = new MigPanel("ReportPanelUI");
this.optionPanel.setOpaque(true);
this.optionPanel.add(ui);
this.optionPanel.setSize(this.optionPanel.getPreferredSize());
this.scrollPane = new JScrollPane(this.optionPanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
this.scrollPane.getVerticalScrollBar().setUnitIncrement(16);
this.panel = new MigPanel(new MigLayout("wrap 1, fill"));
this.panel.add(Utility.localizedHeader(Messages.nameKey(headerKey),
false), "span, center");
}
示例9: ConfigEditorPanel
/**
* Konstruktor.
* Legt den Inhalt des Panels fest.
*/
public ConfigEditorPanel()
{
super(new BorderLayout());
String logPath = PathHelper.getBasePath();
configFile = new File(logPath + "de.entwicklerpages.java.schoolgame");
textArea = new JTextArea("Keine Konfiguration geladen!");
textArea.setEditable(true);
JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
add(scrollPane, BorderLayout.CENTER);
reloadButton = new JButton("Laden");
reloadButton.addActionListener(this);
saveButton = new JButton("Speichern");
saveButton.addActionListener(this);
saveButton.setEnabled(false);
JPanel buttonBar = new JPanel(new GridLayout(1, 2));
buttonBar.add(reloadButton);
buttonBar.add(saveButton);
add(buttonBar, BorderLayout.SOUTH);
}
示例10: MapGeneratorOptionsDialog
/**
* Creates a dialog to set the map generator options.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param frame The owner frame.
* @param editable Whether the options may be edited.
*/
public MapGeneratorOptionsDialog(FreeColClient freeColClient, JFrame frame,
boolean editable) {
super(freeColClient, frame, editable,
freeColClient.getGame().getMapGeneratorOptions(),
MapGeneratorOptions.TAG,
FreeColDirectories.MAP_GENERATOR_OPTIONS_FILE_NAME,
MapGeneratorOptions.TAG);
if (isEditable()) {
loadDefaultOptions();
// FIXME: The update should be solved by PropertyEvent.
final List<File> mapFiles = FreeColDirectories.getMapFileList();
JPanel mapPanel = new JPanel();
for (File f : mapFiles) {
JButton mapButton = makeMapButton(f);
if (mapButton == null) continue;
mapButton.addActionListener((ActionEvent ae) -> {
updateFile(f);
});
mapPanel.add(mapButton);
}
JScrollPane scrollPane = new JScrollPane(mapPanel,
JScrollPane.VERTICAL_SCROLLBAR_NEVER,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.getVerticalScrollBar().setUnitIncrement(16);
scrollPane.getViewport().setOpaque(false);
// FIXME: find out how to do this properly
scrollPane.setMinimumSize(new Dimension(400, 110));
panel.add(scrollPane);
}
initialize(frame, choices());
}
示例11: WarehouseDialog
/**
* Creates a dialog to display the warehouse.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param frame The owner frame.
* @param colony The {@code Colony} containing the warehouse.
*/
public WarehouseDialog(FreeColClient freeColClient, JFrame frame,
Colony colony) {
super(freeColClient, frame);
warehousePanel = new MigPanel(new MigLayout("wrap 4"));
warehousePanel.setOpaque(false);
for (GoodsType type : freeColClient.getGame().getSpecification()
.getStorableGoodsTypeList()) {
warehousePanel.add(new WarehouseGoodsPanel(freeColClient,
colony, type));
}
JScrollPane scrollPane = new JScrollPane(warehousePanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.getVerticalScrollBar().setUnitIncrement(16);
scrollPane.getViewport().setOpaque(false);
scrollPane.setBorder(null);
MigPanel panel = new MigPanel(new MigLayout("fill, wrap 1", "", ""));
panel.add(Utility.localizedHeader(Messages.nameKey("warehouseDialog"), false),
"align center");
panel.add(scrollPane, "grow");
panel.setSize(panel.getPreferredSize());
ImageIcon icon = new ImageIcon(
getImageLibrary().getSmallSettlementImage(colony));
initializeConfirmDialog(frame, true, panel, icon, "ok", "cancel");
}
示例12: MetalworksDocumentFrame
public MetalworksDocumentFrame() {
super("", true, true, true, true);
openFrameCount++;
setTitle("Untitled Message " + openFrameCount);
JPanel top = new JPanel();
top.setBorder(new EmptyBorder(10, 10, 10, 10));
top.setLayout(new BorderLayout());
top.add(buildAddressPanel(), BorderLayout.NORTH);
JTextArea content = new JTextArea(15, 30);
content.setBorder(new EmptyBorder(0, 5, 0, 5));
content.setLineWrap(true);
JScrollPane textScroller = new JScrollPane(content,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
top.add(textScroller, BorderLayout.CENTER);
setContentPane(top);
pack();
setLocation(offset * openFrameCount, offset * openFrameCount);
}
示例13: ResultsPane
public ResultsPane(ResultsModel inModel)
{
setLayout(new BorderLayout());
mdl = inModel;
ColorTimeRenderer large = new ColorTimeRenderer(3);
ColorTimeRenderer medium = new ColorTimeRenderer(2);
//ColorTimeRenderer small = new ColorTimeRenderer(1);
DifferenceRenderer diff = new DifferenceRenderer();
tbl = new JTable(inModel) { public void tableChanged(TableModelEvent e) { super.tableChanged(e); scrollTable(); } };
tbl.setDefaultRenderer(ColorTime.class, new ColorTimeRenderer(1));
tbl.setRowHeight(140);
tbl.setRowSelectionAllowed(false);
//tbl.setIntercellSpacing(new Dimension(8, 8));
TableColumnModel tcm = tbl.getColumnModel();
columnStyle(tcm, 0, 50, 70, 200, medium);
columnStyle(tcm, 1, 50, 70, 200, medium);
columnStyle(tcm, 2, 80, 110, 280, large);
columnStyle(tcm, 3, 180, 230, 700, diff);
columnStyle(tcm, 4, 50, 70, 200, medium);
columnStyle(tcm, 5, 50, 70, 200, medium);
columnStyle(tcm, 6, 80, 110, 280, large);
JScrollPane scroll = new JScrollPane(tbl, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
add(scroll);
}
示例14: buildMainPanel
protected Component buildMainPanel() {
JPanel keyPanel = buildKeyTablePanel();
/*
* Tree of all components from target component down
*/
JPanel treePanel = new JPanel(new BorderLayout());
MyTreeNode top = new MyTreeNode(target);
createNodes(top);
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(this);
tree.setSelectionRow(0);
tree.setCellRenderer(new MyTreeCellRenderer());
JScrollPane treeScroll = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
treePanel.add(treeScroll, BorderLayout.CENTER);
treePanel.setMinimumSize(new Dimension(400, 100));
treePanel.setPreferredSize(new Dimension(800, 300));
/*
* First split between Tree display and Keys
*/
JSplitPane split1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treePanel, keyPanel);
split1.setResizeWeight(0.5);
return split1;
}
示例15: ColopediaPanel
/**
* The constructor that will add the items to this panel.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param id The object identifier of the item to select.
*/
public ColopediaPanel(FreeColClient freeColClient, String id) {
super(freeColClient, new MigLayout("fill",
"[200:]unrelated[550:, grow, fill]", "[][grow, fill][]"));
add(Utility.localizedHeader("colopedia", false),
"span, align center");
listPanel = new MigPanel("ColopediaPanelUI");
listPanel.setOpaque(true);
JScrollPane sl = new JScrollPane(listPanel,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
sl.getVerticalScrollBar().setUnitIncrement(16);
sl.getViewport().setOpaque(false);
add(sl);
detailPanel = new MigPanel("ColopediaPanelUI");
detailPanel.setOpaque(true);
JScrollPane detail = new JScrollPane(detailPanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
detail.getVerticalScrollBar().setUnitIncrement(16);
detail.getViewport().setOpaque(false);
add(detail, "grow");
add(okButton, "newline 20, span, tag ok");
float scale = getImageLibrary().getScaleFactor();
getGUI().restoreSavedSize(this, 200 + (int)(scale*850), 200 + (int)(scale*525));
tree = buildTree();
select(id);
}