本文整理汇总了Java中javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS属性的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS属性的具体用法?Java JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS怎么用?Java JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showDetails
private static void showDetails(RunningVM vm) {
HTMLTextArea area = new HTMLTextArea();
JScrollPane areaScroll = new JScrollPane(area, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
areaScroll.setBorder(BorderFactory.createEmptyBorder());
areaScroll.setViewportBorder(BorderFactory.createEmptyBorder());
areaScroll.setPreferredSize(new Dimension(500, 260));
configureScrollBar(areaScroll.getVerticalScrollBar());
configureScrollBar(areaScroll.getHorizontalScrollBar());
area.setText(getDetails(vm));
area.setCaretPosition(0);
HelpCtx helpCtx = new HelpCtx("ProcessDetails.HelpCtx"); //NOI18N
JButton close = new JButton(Bundle.AttachDialog_BtnClose());
close.setDefaultCapable(true);
DialogDescriptor dd = new DialogDescriptor(areaScroll, Bundle.AttachDialog_DetailsCaption(getProcessName(vm.getMainClass())),
true, new Object[] { close }, close, DialogDescriptor.DEFAULT_ALIGN, helpCtx, null);
Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.pack();
d.setVisible(true);
}
示例2: getOutputPanel
private JPanel getOutputPanel(JTextArea area) {
JPanel panel = getNewPanel();
JScrollPane areapane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
GridBagConstraints g = new GridBagConstraints();
areapane.setViewportView(area);
g.gridx = 0;
g.gridy = 1;
g.weightx = 1;
g.weighty = 1;
g.fill = GridBagConstraints.BOTH;
panel.add(areapane, g);
return panel;
}
示例3: createAndShow
public void createAndShow() throws Exception{
Preferences Config = TEdit.getConfig();
JTextArea area = new JTextArea(10,40);
area.setEditable(false);
String Font_Name = Config.get("FONT_NAME","Monospaced");
int Font_Size = Config.getInt("FONT_SIZE",12);
int Font_Style = Config.getInt("FONT_STYLE",Font.PLAIN);
area.setFont(new Font(Font_Name,Font_Style,Font_Size));
JScrollPane scroll = new JScrollPane(area,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
this.add(scroll,BorderLayout.CENTER);
if(txt == null){
BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("org/ioblako/edit/resources/Help.txt"), "UTF-8"));
for (int c = br.read(); c != -1; c = br.read()) sb.append((char)c);
txt=sb.toString();
}
area.setText(txt);
this.setTitle("Help");
this.pack();
this.setVisible(true);
}
示例4: getView
public JComponent getView() {
if (theMap == null) {
theMap = new View(this);
scroll = new AdjustableSpeedScrollPane(
theMap,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scroll.unregisterKeyboardAction(KeyStroke.getKeyStroke(
KeyEvent.VK_PAGE_DOWN, 0));
scroll.unregisterKeyboardAction(KeyStroke.getKeyStroke(
KeyEvent.VK_PAGE_UP, 0));
layeredPane.setLayout(new InsetLayout(layeredPane, scroll));
layeredPane.add(scroll, JLayeredPane.DEFAULT_LAYER);
}
return theMap;
}
示例5: getHorizontalScrollBarPolicy
@Override
public int getHorizontalScrollBarPolicy() {
if (horizontalScrollBarIsNeeded) {
return JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS;
} else {
return super.getHorizontalScrollBarPolicy();
}
}
示例6: fillJTextArea
private void fillJTextArea() {
this.jtaResults = new JTextArea(27, 60);
this.jtaResults.setText(results);
this.jtaResults.setEditable(false);
jspTextArea = new JScrollPane(jtaResults, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
}
示例7: createConsoleScrollPane
private static JScrollPane createConsoleScrollPane()
{
JTextArea textArea = new JTextArea();
textArea.setEditable(false);
TextAreaOutputStream textAreaOutputStream = new TextAreaOutputStream(textArea);
PrintStream textAreaPrintStream = new PrintStream(textAreaOutputStream);
System.setOut(textAreaPrintStream);
System.setErr(textAreaPrintStream);
return new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
}
示例8: AutoCompletePopupWindow
/**
* Constructor.
*
* @param parent The parent window (hosting the text component).
* @param ac The auto-completion instance.
*/
public AutoCompletePopupWindow(Window parent, final AutoCompletion ac) {
super(parent);
ComponentOrientation o = ac.getTextComponentOrientation();
this.ac = ac;
model = new CompletionListModel();
list = new PopupList(model);
list.setCellRenderer(new DelegatingCellRenderer());
list.addListSelectionListener(this);
list.addMouseListener(this);
JPanel contentPane = new JPanel(new BorderLayout());
JScrollPane sp = new JScrollPane(list,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
// In 1.4, JScrollPane.setCorner() has a bug where it won't accept
// JScrollPane.LOWER_TRAILING_CORNER, even though that constant is
// defined. So we have to put the logic added in 1.5 to handle it
// here.
JPanel corner = new SizeGrip();
//sp.setCorner(JScrollPane.LOWER_TRAILING_CORNER, corner);
boolean isLeftToRight = o.isLeftToRight();
String str = isLeftToRight ? JScrollPane.LOWER_RIGHT_CORNER :
JScrollPane.LOWER_LEFT_CORNER;
sp.setCorner(str, corner);
contentPane.add(sp);
setContentPane(contentPane);
applyComponentOrientation(o);
// Give apps a chance to decorate us with drop shadows, etc.
if (Util.getShouldAllowDecoratingMainAutoCompleteWindows()) {
PopupWindowDecorator decorator = PopupWindowDecorator.get();
if (decorator!=null) {
decorator.decorate(this);
}
}
pack();
setFocusableWindowState(false);
lastLine = -1;
}