当前位置: 首页>>代码示例>>Java>>正文


Java JScrollPane.VERTICAL_SCROLLBAR_ALWAYS属性代码示例

本文整理汇总了Java中javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS属性的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.VERTICAL_SCROLLBAR_ALWAYS属性的具体用法?Java JScrollPane.VERTICAL_SCROLLBAR_ALWAYS怎么用?Java JScrollPane.VERTICAL_SCROLLBAR_ALWAYS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.JScrollPane的用法示例。


在下文中一共展示了JScrollPane.VERTICAL_SCROLLBAR_ALWAYS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MessageTextArea

public MessageTextArea(boolean editable, String text, String labelText) {
    setLayout(new BorderLayout());

    area = new JTextArea("");
    area.setSize(400, 400);
    area.setWrapStyleWord(true);
    area.setAutoscrolls(true);
    area.setLineWrap(true);
    area.setEditable(editable);
    area.setText(text);

    JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.getViewport().add(area);
    scrollPane.setDoubleBuffered(true);
    add(scrollPane, "Center");

    JLabel message = new JLabel(labelText);
    add(message, "North");
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:20,代码来源:MessageWindow.java

示例2: 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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:AttachDialog.java

示例3: init

private void init(JLabel label, String[] columns, TableSorter sorter) {
    tableModel = new PropertiesTableModel(columns);
    tableModel.addTableModelListener(this);
    if(sorter == null) {
        sorter = new TableSorter(tableModel);
    } 
    this.sorter = sorter;   
    table = new SortedTable(this.sorter);
    table.getTableHeader().setReorderingAllowed(false);
    table.setDefaultRenderer(String.class, new PropertiesTableCellRenderer());
    //table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor());
    table.getTableHeader().setReorderingAllowed(true);
    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        
    label.setLabelFor(table);
    setColumns(columns);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PropertiesTable.java

示例4: 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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:PropertiesTable.java

示例5: 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;
}
 
开发者ID:privacyint,项目名称:thornsec-core,代码行数:18,代码来源:FullFrame.java

示例6: 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);
               
}
 
开发者ID:mathhobbit,项目名称:EditCalculateAndChart,代码行数:22,代码来源:HelpFrame.java

示例7: 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;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:17,代码来源:PrivateMap.java

示例8: LogReaderPanel

/**
 * Konstruktor.
 *
 * Zeigt einen schreibgeschützten Editor an.
 *
 * @param logFileName der Name der Log Datei
 */
public LogReaderPanel(String logFileName)
{
    super(new BorderLayout());

    String logPath = PathHelper.getBasePath();
    logFile = new File(logPath + logFileName);

    textArea = new JTextArea("Keine Logs geladen!");
    textArea.setEditable(false);

    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);

    add(reloadButton, BorderLayout.SOUTH);
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:25,代码来源:LogReaderPanel.java

示例9: init

private void init(JLabel label, String[] columns, TableSorter sorter) {
    tableModel = new PropertiesTableModel(columns);
    tableModel.addTableModelListener(this);
    if(sorter == null) {
        sorter = new TableSorter(tableModel);
    } 
    this.sorter = sorter;   
    table = new SortedTable(this.sorter);
    table.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PropertiesTable.class, "tableProperties.AccessibleContext.accessibleName"));
    table.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesTable.class, "tableProperties.AccessibleContext.accessibleDescription"));
    table.getTableHeader().setReorderingAllowed(false);
    TableCellRenderer cellRenderer = new PropertiesTableCellRenderer();
    table.setDefaultRenderer(String.class, cellRenderer);
    table.setRowHeight(Math.max(
            table.getRowHeight(),
            cellRenderer.getTableCellRendererComponent(table, "abc", true, true, 0, 0)//NOI18N
                        .getPreferredSize().height + 2));
    //table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor());
    table.getTableHeader().setReorderingAllowed(true);
    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        
    label.setLabelFor(table);
    setColumns(columns);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:PropertiesTable.java

示例10: 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);
	
}
 
开发者ID:cetic,项目名称:SimQRI,代码行数:7,代码来源:PanelResults.java

示例11: 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);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:39,代码来源:ColopediaPanel.java

示例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);

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:MetalworksDocumentFrame.java

示例13: 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);
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:30,代码来源:ConfigEditorPanel.java

示例14: 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);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:31,代码来源:ResultsPane.java

示例15: initComponents

private void initComponents() {        
    table = new DetailsTable();
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JViewport viewport = new Viewport(table);

    final JScrollPane tableScroll = new JScrollPane(
                                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tableScroll.setViewport(viewport);
    tableScroll.setBorder(BorderFactory.createEmptyBorder());
    tableScroll.setViewportBorder(BorderFactory.createEmptyBorder());
    tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel());
    
    scrollBar = new ScrollBar(JScrollBar.VERTICAL) {
        public int getUnitIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableUnitIncrement(vr, getOrientation(), direction);
        }
        public int getBlockIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableBlockIncrement(vr, getOrientation(), direction);
        }
        public void setValues(int newValue, int newExtent, int newMin, int newMax) {
            setEnabled(newExtent < newMax);
            if (isEnabled() && !isSelectionChanging() && isTrackingEnd())
                newValue = newMax - newExtent;
            super.setValues(newValue, newExtent, newMin, newMax);
        }
    };
    tableScroll.setVerticalScrollBar(scrollBar);
    dataContainer = tableScroll;

    JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER);
    noDataLabel.setEnabled(false);
    noDataContainer = new JPanel(new BorderLayout());
    noDataContainer.setOpaque(false);
    noDataContainer.add(noDataLabel, BorderLayout.CENTER);

    setOpaque(false);
    setLayout(new BorderLayout());
    add(noDataContainer, BorderLayout.CENTER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:DetailsPanel.java


注:本文中的javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。