本文整理匯總了Java中java.awt.ScrollPane.SCROLLBARS_AS_NEEDED屬性的典型用法代碼示例。如果您正苦於以下問題:Java ScrollPane.SCROLLBARS_AS_NEEDED屬性的具體用法?Java ScrollPane.SCROLLBARS_AS_NEEDED怎麽用?Java ScrollPane.SCROLLBARS_AS_NEEDED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.ScrollPane
的用法示例。
在下文中一共展示了ScrollPane.SCROLLBARS_AS_NEEDED屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createVncClientMainWindow
private Frame createVncClientMainWindow(final BufferedImageCanvas canvas, final String title) {
// Create AWT windows
final Frame frame = new Frame(title + " - VNCle");
// Use scrolling pane to support screens, which are larger than ours
final ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
scroller.add(canvas);
scroller.setSize(screen.getFramebufferWidth(), screen.getFramebufferHeight());
frame.add(scroller);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent evt) {
frame.setVisible(false);
shutdown();
}
});
return frame;
}
示例2: setScroll
public void setScroll( boolean hasScroll ) {
if( this.hasScroll == hasScroll ) {
return;
}
this.hasScroll = hasScroll;
if( hasScroll ) {
this.remove(procApp);
ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
sp.add(procApp);
this.add( sp,"Center");
this.validate();
this.repaint();
}
else {
this.removeAll();
this.add( procApp,"Center");
procApp.invalidate();
this.validate();
this.repaint();
}
}
示例3: createVncClientMainWindow
private Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title) {
// Create AWT windows
final Frame frame = new Frame(title + " - VNCle");
// Use scrolling pane to support screens, which are larger than ours
ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
scroller.add(canvas);
scroller.setSize(screen.getFramebufferWidth(), screen.getFramebufferHeight());
frame.add(scroller);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
frame.setVisible(false);
shutdown();
}
});
return frame;
}
示例4: createVncClientMainWindow
protected static Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title, WindowListener windowListener) {
// Create AWT windows
Frame frame = new Frame(title + " - RDP");
// Use scrolling pane to support screens, which are larger than ours
scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
scroller.add(canvas);
scroller.setSize(canvas.getWidth(), canvas.getHeight());
frame.add(scroller);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(windowListener);
return frame;
}
示例5: AWTMCList
public AWTMCList(int numberofcolumns, boolean singleselect, Component c) {
this.rowTheme = new DefaultMCRowTheme(c);
header = new MCListHeader(this, numberofcolumns);
setBackground(rowTheme.getBackground());
eventhandler = new MCListEventHandler(this);
singleselectboolean = singleselect;
list = new MCListVector();
pane = new MCListScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
setSize(1024, 1024);
setLayout(null);
pane.add(this);
add(header);
addMouseListener(eventhandler);
addMouseMotionListener(eventhandler);
Adjustable horizontal = pane.getHAdjustable();
horizontal.setUnitIncrement(10);
Adjustable vertical = pane.getVAdjustable();
vertical.setUnitIncrement(10);
vertical.addAdjustmentListener(new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent e) {
header.setLocation(0, e.getValue());
}
});
addKeyListener(eventhandler);
}
示例6: GenericHelpFrame
public GenericHelpFrame(String s, String t, int h, int w, int X,int Y, int lines, int columns) {
Font textFont = new java.awt.Font("SanSerif", Font.PLAIN, 12);
FontMetrics textFontMetrics = getFontMetrics(textFont);
Font buttonFont = new java.awt.Font("SanSerif", Font.BOLD, 11);
FontMetrics buttonFontMetrics = getFontMetrics(buttonFont);
Color bgColor = MyColors.helpColor; //new Color(245,245,245);
this.pack();
this.setSize(w,h);
this.setLocation(X,Y);
this.setTitle(t);
this.setResizable(false);
setLayout(new BorderLayout());
TextArea hT = new TextArea("",lines,columns, TextArea.SCROLLBARS_NONE);
hT.setEditable(false);
// Set color and font for TextArea.
hT.setForeground(Color.black);
hT.setFont(textFont);
hT.setBackground(bgColor);
// hT.disable();
ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
sp.add(hT);
this.add("Center", sp);
Panel leftPanel = new Panel();
leftPanel.setBackground(MyColors.gray204);
this.add("West",leftPanel);
// Add Dismiss button and bottom panel
Panel botPanel = new Panel();
botPanel.setFont(buttonFont);
botPanel.setBackground(MyColors.gray204);
Button dismissButton = new Button("Cancel");
botPanel.add(dismissButton);
this.add("South", botPanel);
// Insert the text string in the TextArea
hT.appendText("\n" + s);
// Add inner class event handler for Dismiss button
dismissButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
hide();
dispose();
ParamSetup.helpWindowOpen = false;
}
});
// Add window closing button (inner class)
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
hide();
dispose();
ParamSetup.helpWindowOpen = false;
}
});
}
示例7: createButtons
private JPanel createButtons(Plan pc, ColButton[] b, Field[] f, boolean flag) {
// Vector v = new Vector();
// String[] columns = FrameColumnCalculator.getCol(pc, v);
f = pc.getFirstLegende().field;
int nbCol = 4;
int maxNbRow = 5;
JPanel p = new JPanel();
p.setLayout(new GridLayout(0, nbCol, 0, 0));
b = new ColButton[f.length];
boolean needScroll = f.length > nbCol*maxNbRow;
int maxWidth = 0;
int tmp;
FontMetrics fm = null;
if( needScroll ) fm = Toolkit.getDefaultToolkit().getFontMetrics(Aladin.SPLAIN);
for( int i=0; i<f.length; i++ ) {
b[i] = new ColButton(aladin, f[i].name, f[i]);
b[i].setFont(Aladin.SPLAIN);
if( needScroll && (tmp=fm.stringWidth(f[i].name))>maxWidth )
maxWidth = tmp;
p.add(b[i]);
}
if( flag ) {
col1 = b;
fields1 = f;
}
else {
col2 = b;
fields2 = f;
}
// ajout d'un scrollpane s'il y a trop de lignes
if( needScroll ) {
ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
sp.setSize((maxWidth+20)*nbCol+30, 140);
sp.add(p);
JPanel newPanel = new JPanel();
newPanel.add(sp);
return newPanel;
}
else return p;
}