本文整理汇总了Java中javax.swing.JScrollPane.setHorizontalScrollBarPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.setHorizontalScrollBarPolicy方法的具体用法?Java JScrollPane.setHorizontalScrollBarPolicy怎么用?Java JScrollPane.setHorizontalScrollBarPolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.setHorizontalScrollBarPolicy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initComponents
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
stTable = new STTable();
JPanel totalBox = new JPanel(new BorderLayout(10, 10));
JLabel descrLabel = new JLabel(jmt.jmva.analytical.ExactConstants.DESCRIPTION_ReferenceStation);
JPanel descrBox = new JPanel(new BorderLayout());
descrBox.setPreferredSize(new Dimension(200, 1000));
descrBox.add(descrLabel, BorderLayout.NORTH);
JScrollPane visitTablePane = new JScrollPane(stTable);
visitTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
visitTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
totalBox.add(visitTablePane, BorderLayout.CENTER);
totalBox.add(descrBox, BorderLayout.WEST);
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
add(Box.createVerticalStrut(30), BorderLayout.NORTH);
add(Box.createVerticalStrut(30), BorderLayout.SOUTH);
add(Box.createHorizontalStrut(20), BorderLayout.EAST);
add(Box.createHorizontalStrut(20), BorderLayout.WEST);
}
示例2: initComponents
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private void initComponents() {
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
synView = new JTextPane();
synView.setContentType("text/html");
synView.setEditable(false);
synScroll = new JScrollPane(synView);
synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
vBox.add(Box.createVerticalStrut(20));
vBox.add(hBox);
vBox.add(Box.createVerticalStrut(20));
hBox.add(Box.createHorizontalStrut(20));
hBox.add(synScroll);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1, 1));
this.add(vBox);
synView
.setText("<html><body><center><font face=\"bold\" size=\"3\">Saturation Sectors will be here displayed once you solve the model.</font></center></body></html>");
}
示例3: initComponent
import javax.swing.JScrollPane; //导入方法依赖的package包/类
protected void initComponent() {
this.setLayout(new BorderLayout());
jScrollPane1 = new JScrollPane();
jScrollPane1.setBorder(null);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
codePane = new JEditorTextPane();
textLineNumber = new TextLineNumber(codePane);
codePane.setBorder(null);
jScrollPane1.setViewportView(codePane);
jScrollPane1.setRowHeaderView(textLineNumber);
add(jScrollPane1, java.awt.BorderLayout.CENTER);
rightPane = new RightEditorPane();
rightPane.setMaximumSize(new java.awt.Dimension(16, 32767));
rightPane.setMinimumSize(new java.awt.Dimension(16, 100));
rightPane.setPreferredSize(new java.awt.Dimension(16, 469));
add(rightPane, BorderLayout.EAST);
}
示例4: initLayerManager
import javax.swing.JScrollPane; //导入方法依赖的package包/类
protected void initLayerManager() {
JFrame d = new JFrame();
d.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
((JCheckBoxMenuItem)(XML_Menu.commandToMenuItemHash.get("layer_manager_cmd"))).setSelected(false);
}
});
LayerManager lm;
//use existing layer manager if it already exists
if (layerManager != null) {
lm = layerManager;
} else {
lm = new LayerManager();
}
lm.setLayerList( toLayerList(map.overlays) );
lm.setMap(map);
lm.setDialog(d);
JScrollPane sp = new JScrollPane(lm);
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
d.setTitle("Layer Manager");
d.setContentPane(sp);
// d.getContentPane().add(sp);
d.pack();
d.setSize(new Dimension(lm.getPreferredSize().width+20,lm.getPreferredSize().height+55));
d.setMaximumSize(new Dimension(400,300));
d.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
d.setLocationRelativeTo(frame);
d.setState(Frame.NORMAL);
d.setAlwaysOnTop(true);
this.layerManager = lm;
this.layerManagerDialog = d;
}
示例5: initComponents
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private void initComponents() {
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
synView = new JTextPane();
synView.setContentType("text/html");
synView.setEditable(false);
synScroll = new JScrollPane(synView);
synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
vBox.add(Box.createVerticalStrut(30));
vBox.add(hBox);
vBox.add(Box.createVerticalStrut(30));
hBox.add(Box.createHorizontalStrut(20));
hBox.add(synScroll);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1, 1));
this.add(vBox);
}
示例6: insertPalette
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
*
*/
public EditorPalette insertPalette(String title) {
final EditorPalette palette = new EditorPalette();
final JScrollPane scrollPane = new JScrollPane(palette);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
libraryPane.add(title, scrollPane);
// Updates the widths of the palettes if the container size changes
libraryPane.addComponentListener(new ComponentAdapter() {
/**
*
*/
public void componentResized(ComponentEvent e) {
int w = scrollPane.getWidth() - scrollPane.getVerticalScrollBar().getWidth();
palette.setPreferredWidth(w);
}
});
return palette;
}
示例7: initComponents
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
stTable = new STTable();
Box hBox = Box.createHorizontalBox();
hBox.add(Box.createHorizontalStrut(20));
//Horizontal box containing Description label and buttons
Box descrBox = Box.createVerticalBox();
descrBox.add(new JLabel(DESCRIPTION_SERVICETIMES));
descrBox.add(Box.createHorizontalStrut(10));
descrBox.add(new JButton(SWITCH_TO_SD));
descrBox.setPreferredSize(new Dimension(220, 1000));
descrBox.setMinimumSize(new Dimension(200, 200));
hBox.add(descrBox);
hBox.add(Box.createHorizontalStrut(10));
JScrollPane visitTablePane = new JScrollPane(stTable);
visitTablePane.setPreferredSize(new Dimension(1000, 1000));
visitTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
visitTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
hBox.add(visitTablePane);
hBox.add(Box.createHorizontalStrut(20));
Box totalBox = Box.createVerticalBox();
totalBox.add(Box.createVerticalStrut(20));
totalBox.add(hBox);
totalBox.add(Box.createVerticalStrut(20));
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
}
示例8: makePreviewTable
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Fills the tablePane with content.
*/
private JComponent makePreviewTable() {
previewTable = new ExtendedJTable(false, false, false);
// ensure same background as JPanels in case of only few rows
previewTable.setBackground(Colors.PANEL_BACKGROUND);
previewTable.setColoredTableCellRenderer(new ColoredTableCellRenderer() {
private final Font boldFont = getFont().deriveFont(Font.BOLD);
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
adjustCell(row, label, boldFont);
return label;
}
});
loadingContentPane = new LoadingContentPane("loading_data", previewTable);
tablePane = new JScrollPane(loadingContentPane);
tablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
tablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
tablePane.setBorder(null);
// add PREVIEW label in front of scrollpane
JLayeredPane layeredPane = new JLayeredPane();
layeredPane.setLayout(new OverlayLayout(layeredPane));
layeredPane.add(tablePane, JLayeredPane.DEFAULT_LAYER);
JPanel overlayPanel = new JPanel(new BorderLayout());
overlayPanel.setOpaque(false);
overlayLabel = new JLabel("", SwingConstants.CENTER);
showPreviewLettering();
overlayPanel.add(overlayLabel, BorderLayout.CENTER);
layeredPane.add(overlayPanel, JLayeredPane.PALETTE_LAYER);
return layeredPane;
}
示例9: redraw
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public void redraw() {
// Redraws only if data has changed - Bertoli Marco
if (old_data == data) {
return;
} else {
old_data = data;
}
if (data.hasResults() && data.areResultsOK() && data.getResults().size() > 0) {
if (data.getClasses() == 2) {
this.removeAll();
Sectors2DPanel s2dp = new Sectors2DPanel(data.getResults(), data.getClassNames());
this.add(s2dp);
repaint();
} else if (data.getClasses() == 3) {
this.removeAll();
Sectors3DPanel s3dp = new Sectors3DPanel(data.getResults(), data.getClassNames());
this.add(s3dp);
repaint();
}
} else {
this.removeAll();
JEditorPane synView = new JTextPane();
synView.setContentType("text/html");
synView.setEditable(false);
JScrollPane synScroll = new JScrollPane(synView);
synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
synView
.setText("<html><body><center><font face=\"bold\" size=\"3\">Saturation Sectors will be here displayed once you solve the model.</font></center></body></html>");
this.add(synScroll);
}
}
示例10: paintChat
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public void paintChat(JPanel _panel) throws Exception{
//Define all new Components GUI
JTextArea _tex = new JTextArea(17,42);
JPanel chatPanel = new JPanel();
JButton refresh = new JButton("Refresh");
JButton send = new JButton("Send");
JTextField input = new JTextField(25);
JScrollPane scroll = new JScrollPane(_tex);
//Setup Connection to Server
SFTPChannel channelIns = new SFTPChannel();
channelIns.closeChannel();
SFTPConstants.configConnectInfo();
ChannelSftp channel = channelIns.getChannel(SFTPConstants.connectInfo, 5000);
//Add action Listener
refresh.addActionListener(event -> refreshText(_tex));
send.addActionListener(event -> sendText(input, channel));
//add to pane and manage layout
_panel.add(scroll, BorderLayout.CENTER);
_panel.add(chatPanel, BorderLayout.SOUTH);
chatPanel.add(refresh);
chatPanel.add(input);
chatPanel.add(send);
//set components properties
_tex.setEditable(false);
scroll.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scroll.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
}
示例11: initComponents
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
visitTable = new VisitTable();
JPanel totalBox = new JPanel(new BorderLayout(10, 10));
//Horizontal box containing Description label and buttons
JLabel descrLabel = new JLabel(DESCRIPTION_VISITS);
JPanel descrBox = new JPanel(new BorderLayout());
descrBox.setPreferredSize(new Dimension(200, 1000));
descrBox.add(descrLabel, BorderLayout.NORTH);
JScrollPane visitTablePane = new JScrollPane(visitTable);
visitTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
visitTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
totalBox.add(visitTablePane, BorderLayout.CENTER);
totalBox.add(descrBox, BorderLayout.WEST);
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
add(Box.createVerticalStrut(30), BorderLayout.NORTH);
add(Box.createVerticalStrut(30), BorderLayout.SOUTH);
add(Box.createHorizontalStrut(20), BorderLayout.EAST);
add(Box.createHorizontalStrut(20), BorderLayout.WEST);
}
示例12: getUsableControl
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* set up the editor control of the field
*
* @param jc
* @return
*/
JComponent getUsableControl(JComponent jc) {
if (jc instanceof JTextArea) {
JScrollPane js = new JScrollPane();
js.setPreferredSize(new Dimension(200, 100));
js.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
js.setViewportView(jc);
return js;
} else {
return jc;
}
}
示例13: initComponents
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* create components and lay them out
*/
private void initComponents() {
ldTable = new LDTable();
//ldTitle=new JLabel("LD editor");
//ldTitle.setHorizontalAlignment(SwingConstants.CENTER);
//ldTitle.setHorizontalTextPosition(SwingConstants.CENTER);
//ldTitle.setFont(new Font("Arial",Font.BOLD|Font.ITALIC,14));
ldExpression = new JTextField();
ldExpression.addActionListener(new ActionListener() { // evaluate as the use presses enter
public void actionPerformed(ActionEvent e) {
EVALUATE.actionPerformed(e);
}
});
/*JPanel cp=new JPanel();
cp.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(),
BorderFactory.createEtchedBorder()));
getContentPane().add(cp);*/
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
cp.add(makeButtons(), BorderLayout.SOUTH);
Box vBox = Box.createVerticalBox();
vBox.add(Box.createVerticalStrut(5));
JScrollPane ldTablePane = new JScrollPane(ldTable);
ldTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
ldTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
vBox.add(ldTablePane);
//vBox.add(Box.createVerticalStrut(5));
vBox.add(makeTools());
//vBox.add(Box.createVerticalStrut(5));
Box totalBox = Box.createHorizontalBox();
totalBox.add(Box.createHorizontalStrut(5));
totalBox.add(vBox);
totalBox.add(Box.createHorizontalStrut(5));
cp.add(totalBox, BorderLayout.CENTER);
//cp.add(ldTitle,BorderLayout.NORTH);
}
示例14: initComponents
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
stationSpinner.addChangeListener(spinnerListener);
stationTable = new StationTable();
/* and now some Box black magic */
Box stationSpinnerBox = Box.createHorizontalBox();
//OLD
//DEK (Federico Granata) 26-09-2003
//JLabel spinnerLabel = new JLabel("<html><font size=\"4\">Set the number of stations (1-" + MAX_STATIONS + "):</font></html>");
//NEW
//@author Stefano
JLabel spinnerLabel = new JLabel(DESCRIPTION_STATIONS);
//spinnerLabel.setMaximumSize(new Dimension(300, 18));
stationSpinnerBox.add(spinnerLabel);
stationSpinnerBox.add(Box.createHorizontalStrut(10));
Box numberBox = Box.createVerticalBox();
JPanel spinnerPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
JLabel numberLabel = new JLabel("Number:");
stationSpinner.setMaximumSize(new Dimension(600, 18));
spinnerPanel.add(numberLabel);
spinnerPanel.add(stationSpinner);
numberBox.add(spinnerPanel);
numberBox.add(new JButton(addStation));
numberBox.setMaximumSize(new Dimension(300, 150));
stationSpinnerBox.add(numberBox);
//END
Box stationBox = Box.createVerticalBox();
stationBox.add(Box.createVerticalStrut(30));
stationBox.add(stationSpinnerBox);
stationBox.add(Box.createVerticalStrut(10));
JScrollPane stationTablePane = new JScrollPane(stationTable);
stationTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
stationTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
stationBox.add(stationTablePane);
stationBox.add(Box.createRigidArea(new Dimension(10, 20)));
Box totalBox = Box.createHorizontalBox();
totalBox.add(Box.createHorizontalStrut(20));
totalBox.add(stationBox);
totalBox.add(Box.createHorizontalStrut(20));
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
}
示例15: createExtComponent
import javax.swing.JScrollPane; //导入方法依赖的package包/类
@Override
protected JComponent createExtComponent() {
JTextComponent component = getComponent();
JLayeredPane layers = new LayeredEditorPane(component);
layers.add(component, JLayeredPane.DEFAULT_LAYER, 0);
// MyInternalFrame window = new MyInternalFrame();
// layers.add(window, JLayeredPane.PALETTE_LAYER);
// window.show();
// Add the scroll-pane with the component to the center
JScrollPane scroller = new JScrollPane(layers);
scroller.getViewport().setMinimumSize(new Dimension(4,4));
// remove default scroll-pane border, winsys will handle borders itself
Border empty = BorderFactory.createEmptyBorder();
// Important: Do not delete or use null instead, will cause
//problems on GTK L&F. Must set both scroller border & viewport
//border! - Tim
scroller.setBorder(empty);
scroller.setViewportBorder(empty);
if (component.getClientProperty("nbeditorui.vScrollPolicy") != null) {
scroller.setVerticalScrollBarPolicy(
(Integer)component.getClientProperty("nbeditorui.vScrollPolicy"));
}
if (component.getClientProperty("nbeditorui.hScrollPolicy") != null) {
scroller.setHorizontalScrollBarPolicy(
(Integer)component.getClientProperty("nbeditorui.hScrollPolicy"));
}
// extComponent will be a panel
JComponent ec = new JPanel(new BorderLayout());
ec.putClientProperty(JTextComponent.class, component);
ec.add(scroller);
// Initialize sidebars
// Need to clear the cache - it's null at this point when opening file but the sidebars
// would be reused during L&F change (see BaseTextUI.UIWatcher) which would not work properly.
CustomizableSideBar.resetSideBars(component);
Map<SideBarPosition, JComponent> sideBars = CustomizableSideBar.getSideBars(component);
processSideBars(sideBars, ec, scroller);
if (listener == null){
listener = new SideBarsListener(component);
CustomizableSideBar.addChangeListener(NbEditorUtilities.getMimeType(component), listener);
}
// Initialize the corner component
initGlyphCorner(scroller);
return ec;
}