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


Java JScrollPane.HORIZONTAL_SCROLLBAR_NEVER属性代码示例

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


在下文中一共展示了JScrollPane.HORIZONTAL_SCROLLBAR_NEVER属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ErrorPanel

/**
 * Creates an error panel containing the log file.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public ErrorPanel(FreeColClient freeColClient) {
    super(freeColClient, new MigLayout());

    String message = FreeColDirectories.getLogFileContents();
    if (message == null) message = Messages.message("errorPanel.loadError");

    JTextArea textArea = Utility.getDefaultTextArea(message, columnWidth);
    textArea.setFocusable(true);
    textArea.setEditable(false);
    
    JScrollPane scrollPane = new JScrollPane(textArea,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.getViewport().setOpaque(false);

    add(scrollPane, "height 200:200:, wrap 20");
    add(okButton, "tag ok");
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:23,代码来源:ErrorPanel.java

示例3: setTreeHorizontalScrollBarPolicy

/**
    * Determines when the horizontal scrollbar appears in the tree column.
    * The options are:<ul>
    * <li><code>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED</code>
    * <li><code>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER</code>
    * <li><code>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS</code>
    * </ul>
    *
    * @param policy one of the three values listed above
    * @exception IllegalArgumentException if <code>policy</code>
    *				is not one of the legal values shown above
    * @see #getTreeHorizontalScrollBarPolicy
    * @since 6.30
    *
    * @beaninfo
    *   preferred: true
    *       bound: true
    * description: The tree column scrollbar policy
    *        enum: HORIZONTAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
    *              HORIZONTAL_SCROLLBAR_NEVER ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
    *              HORIZONTAL_SCROLLBAR_ALWAYS ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
    */
   public void setTreeHorizontalScrollBarPolicy(int policy) {
       if (policy == treeHorizontalScrollBarPolicy) {
           return ;
       }
switch (policy) {
           case HORIZONTAL_SCROLLBAR_AS_NEEDED:
           case HORIZONTAL_SCROLLBAR_NEVER:
           case HORIZONTAL_SCROLLBAR_ALWAYS:
                   break;
           default:
               throw new IllegalArgumentException("invalid treeHorizontalScrollBarPolicy");
}
int old = treeHorizontalScrollBarPolicy;
treeHorizontalScrollBarPolicy = policy;
       boolean wasHScrollBarVisible = isTreeHScrollBar;
       isTreeHScrollBar = (policy != JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
       if (wasHScrollBarVisible != isTreeHScrollBar) {
           if (!wasHScrollBarVisible) {
               outline.getColumnModel().addColumnModelListener(listener);
           } else {
               outline.getColumnModel().removeColumnModelListener(listener);
           }
           outline.setTreeHScrollingEnabled(isTreeHScrollBar, hScrollBar);
       }
firePropertyChange("treeHorizontalScrollBarPolicy", old, policy);
revalidate();
repaint();
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:50,代码来源:OutlineView.java

示例4: getComponent

private JComponent getComponent() {
    if (component == null) {
        ScrollableContainer container = new ScrollableContainer(getPanel(),
                                    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        container.setViewportBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
        container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
        component = container;
    }
    return component;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:TracerOptionsPanelController.java

示例5: initialize

/**
 * Initialize the panel
 */
private void initialize() {
	// Initialize dialog layout
	
	JPanel panel = new JPanel(new BorderLayout(BORDERSIZE / 2, BORDERSIZE / 2));
	panel.setBorder(BorderFactory.createEmptyBorder(BORDERSIZE, BORDERSIZE, BORDERSIZE, BORDERSIZE));
	// Adds website image
	JPanel tmpPanel = new JPanel(new BorderLayout(BORDERSIZE, BORDERSIZE));
	// Adds polimi description
	HtmlPanel titleLabel = new HtmlPanel();
	titleLabel.setText(GraphStartScreen.HTML_CONTENT_TITLE_HREF);
	titleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
	titleLabel.setAlignmentY(Component.CENTER_ALIGNMENT);
	titleLabel.setOpaque(false);
	tmpPanel.add(titleLabel, BorderLayout.CENTER);

	// Adds application title
	title = new JLabel();
	title.setHorizontalTextPosition(SwingConstants.RIGHT);
	title.setHorizontalAlignment(SwingConstants.CENTER);
	title.setIconTextGap(BORDERSIZE);
	tmpPanel.add(title, BorderLayout.SOUTH);

	panel.add(tmpPanel, BorderLayout.NORTH);

	// Adds text area
	mainArea = new JPanel();
	mainArea.setOpaque(false);
	BoxLayout mainLayout = new BoxLayout(mainArea, BoxLayout.Y_AXIS);
	mainArea.setLayout(mainLayout);
	
	panel.add(mainArea, BorderLayout.CENTER);

	JLabel legal = new JLabel(LEGAL);
	panel.add(legal, BorderLayout.SOUTH);
	panel.setPreferredSize(new Dimension(600,480));
	JScrollPane scroll = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	this.add(scroll, BorderLayout.CENTER);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:41,代码来源:AboutDialogPanel.java

示例6: StatisticsPanel

/**
 * Creates the statistics panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param serverStatistics A map of key,value pairs of server statistics.
 * @param clientStatistics A map of key,value pairs of client statistics.
 */
public StatisticsPanel(FreeColClient freeColClient,
                       Map<String, String> serverStatistics,
                       Map<String, String> clientStatistics) {
    super(freeColClient, new BorderLayout());

    // Title
    JPanel header = new JPanel();
    this.add(header, BorderLayout.PAGE_START);
    header.add(Utility.localizedLabel("statistics"), JPanel.CENTER_ALIGNMENT);

    // Actual stats panel
    JPanel statsPanel = new JPanel(new GridLayout(1,2));
    JScrollPane scrollPane = new JScrollPane(statsPanel,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    // correct way to make scroll pane opaque
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setBorder(null);

    this.add(scrollPane,BorderLayout.CENTER);
    statsPanel.add(displayStatsMessage("client", clientStatistics));
    statsPanel.add(displayStatsMessage("server", serverStatistics));

    add(okButton, BorderLayout.PAGE_END);

    setSize(getPreferredSize());
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:34,代码来源:StatisticsPanel.java

示例7: 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

示例8: IssueTable

public IssueTable(String repositoryId, String queryName, QueryController controller, ColumnDescriptor[] descriptors, final boolean isSaved) {
    this(repositoryId, queryName, controller, descriptors, isSaved, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:IssueTable.java

示例9: initComponents

private void initComponents() {
    JTable impl = new JTable(new DefaultTableModel(new Object[] { "" }, 0)); // NOI18N
    TableColumnModel colMod = impl.getColumnModel();
    final TableColumn col = colMod.getColumn(0);
    impl.setFocusable(false);
    header = new Header(colMod);
    impl.setTableHeader(header);
    header.setResizingAllowed(false);
    header.setReorderingAllowed(false);

    final TableCellRenderer renderer = header.getDefaultRenderer();
    header.setDefaultRenderer(new TableCellRenderer() {
        public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {

            Component component = renderer.getTableCellRendererComponent(
                    table, getRendererValue(), isSelected(),
                    isSelected(), row, processMouseEvents() ? 0 : 1);

            setupRenderer(component);

            col.setWidth(header.getWidth());
            return component;
        }
    });

    JScrollPane scroll = new JScrollPane(impl, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                                               JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
        public Dimension getPreferredSize() { return header.getPreferredSize(); }
        public void reshape(int x, int y, int width, int height) {
            header.setPreferredSize(new Dimension(width, height));
            super.reshape(x, y, width, height);
        }
    };
    scroll.setBorder(BorderFactory.createEmptyBorder());
    scroll.setViewportBorder(BorderFactory.createEmptyBorder());

    setLayout(new OverlayLayout(this));
    add(scroll);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:HeaderPanel.java

示例10: FeaturesView

public FeaturesView(Component defaultView, String buttonString) {
    if (UIUtils.isOracleLookAndFeel()) {
        setOpaque(true);
        setBackground(UIUtils.getProfilerResultsBackground());
    } else {
        setOpaque(false);
    }
    setBorder(BorderFactory.createEmptyBorder());
    setLayout(new BorderLayout(0, 0));
    
    if (defaultView != null) {
        JScrollPane sp = new JScrollPane(defaultView, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
            public Dimension getMinimumSize() { return getPreferredSize(); }
        };
        sp.getVerticalScrollBar().setUnitIncrement(20);
        sp.setBorder(null);
        sp.setViewportBorder(null);

        this.defaultView = sp;
        add(this.defaultView, BorderLayout.CENTER);
    } else {
        this.defaultView = null;
    }
    
    if (buttonString != null) {
        hintLabel = new JLabel();
        hintLabel.setIcon(Icons.getIcon(GeneralIcons.INFO));
        hintLabel.setIconTextGap(hintLabel.getIconTextGap() + 1);
        hintLabel.setOpaque(false);
        
        Font font = new JToolTip().getFont();
        
        Color f = hintLabel.getForeground();
        int r = f.getRed() + 70;
        if (r > 255) r = f.getRed() - 70; else r = Math.min(r, 70);
        int g = f.getGreen() + 70;
        if (g > 255) g = f.getRed() - 70; else g = Math.min(g, 70);
        int b = f.getBlue() + 70;
        if (b > 255) b = f.getRed() - 70; else b = Math.min(b, 70);
        hintLabel.setText("<html><body text=\"rgb(" + r + ", " + g + ", " + b + ")\" style=\"font-size: " + //NOI18N
                          (font.getSize()) + "pt; font-family: " + font.getName() + ";\">" + //NOI18N
                          Bundle.FeaturesView_noData("<b>" + buttonString + "</b>") + "</body></html>"); //NOI18N
        
        hintLabel.setSize(hintLabel.getPreferredSize());
        
        Color c = UIUtils.getProfilerResultsBackground();
        hintColor = Utils.checkedColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 245));
    } else {
        hintColor = null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:FeaturesView.java

示例11: IndividualDataPanel

public IndividualDataPanel(ZooracleContentPanel zooracleContentPanel)
	{
		this.zooracleContentPanel = zooracleContentPanel;
		
		labelName     = GUISettings.getDefaultLabel(Locale.labelName, lw, lh, a, va); 
		labelGender   = GUISettings.getDefaultLabel(Locale.labelSex, lw, lh, a, va);
		labelComment  = GUISettings.getDefaultLabel(Locale.labelComment, lw, 80, a, va);
		labelMetaData = GUISettings.getDefaultLabel(Locale.labelMetaData, lw, 100, a, va);
		
		textFieldName = new JTextField("");   textFieldName.setPreferredSize(new Dimension(200, 30)); textFieldName.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		textAreaComment = new JTextArea();  textAreaComment.setPreferredSize(new Dimension(200, 80)); 
		textAreaComment.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		
		comboBoxGender = new JComboBox(); 
//		comboBoxGender.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		for (Object item : Locale.dropDownGenders)
			comboBoxGender.addItem(item);
		
		// Create some items to add to the list
		String listData[] =
		{
			"BT_1.1",
			"BT_1.2",
			"BT_1.3",
			"BT_1.4"
		};
		
		metaList = new JList(listData);
		JScrollPane metaScrollPane = new JScrollPane(metaList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		metaScrollPane.setPreferredSize(new Dimension(200, 100));
		
		
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		
		JPanel panelName     = new JPanel(new FlowLayout(FlowLayout.LEFT)); 
		JPanel panelGender   = new JPanel(new FlowLayout(FlowLayout.LEFT));
		JPanel panelComment  = new JPanel(new FlowLayout(FlowLayout.LEFT));
		JPanel panelMetaList = new JPanel(new FlowLayout(FlowLayout.LEFT));
		
		
		panelName.add(labelName);
		panelName.add(textFieldName);

		panelGender.add(labelGender);
		panelGender.add(comboBoxGender);

		panelComment.add(labelComment);
		panelComment.add(textAreaComment);

		panelMetaList.add(labelMetaData);
		panelMetaList.add(metaScrollPane);
		
		this.add(panelName);
		this.add(panelGender);
		this.add(panelComment);
		this.add(panelMetaList);
		
		this.setBackground(GUISettings.windowColor);
		this.setForeground(GUISettings.windowColor);
		
		this.setMinimumSize(new Dimension(300, 500));
		
		
	}
 
开发者ID:fossasia,项目名称:zooracle,代码行数:64,代码来源:IndividualDataPanel.java

示例12: InformationPanel

/**
 * Creates an information panel that shows the given
 * texts and images, and an "OK" button.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param texts The texts to be displayed in the panel.
 * @param fcos The source {@code FreeColObject}s for the text.
 * @param images The images to be displayed in the panel.
 *
 * @see #createLayout(FreeColClient) For the outer layout
 */
public InformationPanel(FreeColClient freeColClient, String[] texts,
                        FreeColObject[] fcos, ImageIcon[] images) {
    super(freeColClient, createLayout(freeColClient));

    final SwingGUI gui = getGUI();
    JPanel textPanel = new MigPanel();
    textPanel.setOpaque(false);
    textPanel.setLayout(new MigLayout("wrap 2", "", "top"));
    for (int i = 0; i < texts.length; i++) {
        if (images != null && images[i] != null) {
            textPanel.add(new JLabel(images[i]));
            textPanel.add(Utility.getDefaultTextArea(texts[i],
                new Dimension(BASE_WIDTH - images[i].getIconWidth(),
                              BASE_HEIGHT)));
        } else {
            textPanel.add(Utility.getDefaultTextArea(texts[i],
                new Dimension(BASE_WIDTH, BASE_HEIGHT)), "skip");
        }
        StringTemplate disp = displayLabel(fcos[i]);
        if (disp == null) continue;
        JButton button = Utility.localizedButton(StringTemplate
            .template("informationPanel.display")
            .addStringTemplate("%object%", disp));
        final FreeColObject fco = fcos[i];
        button.addActionListener((ActionEvent ae) -> {
                gui.displayObject(fco);
            });
        /*
        If there is another text to display, we need to add
            "gapbottom 25" into the .add(), which gives some
            cushion between each text block
        */
        if ((i + 1) < texts.length) {
            textPanel.add(button, "skip, gapbottom 25");
        } else {
            textPanel.add(button, "skip");
        }

    }

    JScrollPane scrollPane = new JScrollPane(textPanel,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    // correct way to make scroll pane opaque
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setBorder(null);
    setBorder(null);

    add(scrollPane);
    add(okButton, "tag ok");
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:62,代码来源:InformationPanel.java

示例13: Console

public Console(int width, int height)
{
	Font font = null;
	try
	{
		font = Font.createFont(Font.PLAIN, new File(new ResourceLocation("base:console.ttf").getFilePath())).deriveFont(12F);
	}
	catch(FontFormatException | IOException e)
	{
		e.printStackTrace();
	}

	this.frame = new JFrame();
	this.frame.setSize(width, height);
	this.frame.setPreferredSize(new Dimension(width, height));
	this.frame.setMinimumSize(new Dimension(20 + this.maxLength * 10, 20 + 100));
	Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
	this.frame.setLocation(dim.width / 2 - width / 2, dim.height / 2 - height / 2);
	this.frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	this.frame.addWindowListener(this.adapter);

	this.inputField = new JTextField();
	this.panel = new JPanel();
	{
		this.panel.setLayout(new BorderLayout());

		this.textContent = new JTextPane();
		this.textContent.setBorder(new EmptyBorder(10, 10, 10, 10));
		this.textContent.setEditable(false);
		this.textContent.setFont(font);
		this.textContent.addMouseListener(this.adapter);

		JScrollPane scrollPane = new JScrollPane(this.textContent,
				JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
				JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		scrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(0,0));
		scrollPane.setBorder(null);

		this.panel.add(scrollPane, BorderLayout.CENTER);

		this.inputField.setBorder(new EmptyBorder(10, 10, 10, 10));
		this.inputField.setFont(font);
		this.inputField.addKeyListener(this.adapter);
		this.inputField.addActionListener(this.adapter);

		this.panel.add(this.inputField, BorderLayout.SOUTH);
	}
	this.frame.setContentPane(this.panel);

	this.frame.pack();
	this.frame.setVisible(true);

	this.inputField.requestFocus();

	this.addCommand(null, args -> this.error("Invalid command."));
	this.addCommand("clear", args -> this.clear());
	this.addCommand("exit", args -> this.quit());
	this.addCommand("typewriter", args -> this.setTypeWriterMode(Boolean.parseBoolean(args[0])));
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:59,代码来源:Console.java


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