javax.swing.JScrollPane#setBorder ( )源码实例Demo

下面列出了javax.swing.JScrollPane#setBorder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: visualvm   文件: AttachDialog.java
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 项目: visualvm   文件: ThreadDumpWindow.java
public ThreadDumpWindow(ThreadDump td) {
    setLayout(new BorderLayout());
    setFocusable(true);
    setRequestFocusEnabled(true);
    setName(Bundle.ThreadDumpWindow_Caption(StringUtils.formatUserDate(td.getTime())));
    setIcon(Icons.getImage(ProfilerIcons.THREAD));

    StringBuilder text = new StringBuilder();
    printThreads(text, td);
    a = new HTMLTextArea() {
        protected void showURL(URL url) {
            if (url == null) {
                return;
            }
            String urls = url.toString();
            ThreadDumpWindow.this.showURL(urls);
        }
    };
    a.setEditorKit(new CustomHtmlEditorKit());
    a.setText(text.toString());
    a.setCaretPosition(0);
    JScrollPane sp = new JScrollPane(a);
    sp.setBorder(BorderFactory.createEmptyBorder());
    sp.setViewportBorder(BorderFactory.createEmptyBorder());
    add(sp, BorderLayout.CENTER);
}
 
源代码3 项目: RipplePower   文件: UIRes.java
public static void addStyle(JScrollPane jScrollPane, String labelName, boolean bottom) {
	Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
	TitledBorder titled = BorderFactory.createTitledBorder(line, labelName);
	titled.setTitleFont(GraphicsUtils.getFont("Verdana", 0, 13));
	titled.setTitleColor(fontColorTitle);
	Border empty = null;
	if (bottom) {
		empty = new EmptyBorder(5, 8, 5, 8);
	} else {
		empty = new EmptyBorder(5, 8, 0, 8);
	}
	CompoundBorder border = new CompoundBorder(titled, empty);
	jScrollPane.setBorder(border);
	jScrollPane.setForeground(fontColor);
	jScrollPane.setBackground(Color.WHITE);
	jScrollPane.setFont(GraphicsUtils.getFont("Monospaced", 0, 13));
	jScrollPane.setHorizontalScrollBar(null);
}
 
源代码4 项目: IntelliJ-Key-Promoter-X   文件: TipPanel.java
TipPanel() {
  setLayout(new BorderLayout());
  if (isWin10OrNewer && !isUnderDarcula()) {
    setBorder(JBUI.Borders.customLine(xD0, 1, 0, 0, 0));
  }
  myBrowser = TipUIUtil.createBrowser();
  myBrowser.getComponent().setBorder(JBUI.Borders.empty(8, 12));
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myBrowser.getComponent(), true);
  scrollPane.setBorder(JBUI.Borders.customLine(DIVIDER_COLOR, 0, 0, 1, 0));
  add(scrollPane, BorderLayout.CENTER);

  JLabel kpxIcon = new JBLabel(IconUtil.scale(KeyPromoterIcons.KP_ICON, this, 3.0f));
  kpxIcon.setSize(128, 128);
  kpxIcon.setBorder(JBUI.Borders.empty(0, 10));
  kpxIcon.setForeground(SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES.getFgColor());

  JLabel versionLabel = new JBLabel(KeyPromoterBundle.message("kp.tool.window.name"));
  versionLabel.setFont(new Font(versionLabel.getName(), Font.BOLD, 24));
  versionLabel.setForeground(JBUI.CurrentTheme.Label.foreground(false));
  JBBox horizontalBox = JBBox.createHorizontalBox();
  horizontalBox.setAlignmentX(.5f);
  horizontalBox.add(kpxIcon);
  horizontalBox.add(versionLabel);

  add(horizontalBox, BorderLayout.NORTH);
}
 
源代码5 项目: triplea   文件: BattleDisplay.java
RetreatComponent(final Collection<Territory> possible) {
  this.setLayout(new BorderLayout());
  final JLabel label = new JLabel("Retreat to...");
  label.setBorder(new EmptyBorder(0, 0, 10, 0));
  this.add(label, BorderLayout.NORTH);
  final JPanel imagePanel = new JPanel();
  imagePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  imagePanel.add(retreatTerritory);
  imagePanel.setBorder(new EmptyBorder(10, 10, 10, 0));
  this.add(imagePanel, BorderLayout.EAST);
  list = new JList<>(SwingComponents.newListModel(possible));
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  if (!possible.isEmpty()) {
    list.setSelectedIndex(0);
  }
  final JScrollPane scroll = new JScrollPane(list);
  this.add(scroll, BorderLayout.CENTER);
  scroll.setBorder(new EmptyBorder(10, 0, 10, 0));
  updateImage();
  list.addListSelectionListener(e -> updateImage());
}
 
源代码6 项目: SVG-Android   文件: VectorEditorPanel.java
private void buildVectorViewer() {
    JPanel panel = new JPanel(new BorderLayout());

    JSplitPane splitter = new JSplitPane();
    splitter.setContinuousLayout(true);
    splitter.setResizeWeight(0.75);
    splitter.setBorder(null);

    VectorContentViewer contentViewer = new VectorContentViewer(mData, this);
    JScrollPane scroller = new JScrollPane(contentViewer);
    scroller.setOpaque(false);
    scroller.setBorder(null);
    scroller.getViewport().setBorder(null);
    scroller.getViewport().setOpaque(false);
    splitter.setLeftComponent(scroller);

    mImageViewer = new VectorImageViewer(mData);
    splitter.setRightComponent(mImageViewer);

    panel.add(splitter, BorderLayout.CENTER);
    add(panel);
}
 
源代码7 项目: CodenameOne   文件: BasicOutlookBarUI.java
public JScrollPane makeScrollPane(Component component) {
  // the component is not scrollable, wraps it in a ScrollableJPanel
  JScrollPane scroll = new JScrollPane();
  scroll.setBorder(BorderFactory.createEmptyBorder());
  if (component instanceof Scrollable) {
    scroll.getViewport().setView(component);
  } else {
    scroll.getViewport().setView(new ScrollableJPanel(component));
  }
  scroll.setOpaque(false);
  scroll.getViewport().setOpaque(false);
  return scroll;
}
 
源代码8 项目: CQL   文件: AqlViewer.java
private <e, L> void apgInst0(JTabbedPane pane, ApgInstance<L, e> G) {
	List<JComponent> list = new LinkedList<>();

	Object[][] rowData;
	Object[] colNames;

	rowData = new Object[G.Es.size()][3];
	colNames = new Object[3];
	colNames[0] = "Element";
	colNames[1] = "Label";
	colNames[2] = "Value";
	int j = 0;
	for (Entry<e, Pair<L, ApgTerm<L, e>>> lt : G.Es.entrySet()) {
		rowData[j][0] = lt.getKey();
		rowData[j][1] = lt.getValue().first;
		rowData[j][2] = lt.getValue().second;
		j++;
	}
	list.add(GuiUtil.makeTable(BorderFactory.createEmptyBorder(), "Data", rowData, colNames));

	JPanel c = new JPanel();
	c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS));

	for (JComponent x : list) {
		x.setAlignmentX(Component.LEFT_ALIGNMENT);
		x.setMinimumSize(x.getPreferredSize());
		c.add(x);
	}

	JPanel p = new JPanel(new GridLayout(1, 1));
	p.add(c);
	JScrollPane jsp = new JScrollPane(p);

	c.setBorder(BorderFactory.createEmptyBorder());
	p.setBorder(BorderFactory.createEmptyBorder());
	jsp.setBorder(BorderFactory.createEmptyBorder());
	pane.addTab("Tables", p);
}
 
源代码9 项目: magarena   文件: DeckDescriptionViewer.java
public DeckDescriptionViewer() {

        setOpaque(false);

        final TitleBar titleBar = new TitleBar(MText.get(_S1));

        textArea = new JTextArea();
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        textArea.setBackground(FontsAndBorders.TEXTAREA_TRANSPARENT_COLOR_HACK);

        scrollPane = new JScrollPane(textArea);
        scrollPane.getVerticalScrollBar().setUnitIncrement(8);
        scrollPane.setBorder(null);
        scrollPane.getViewport().setOpaque(false);
        scrollPane.setMinimumSize(new Dimension(0, 0));
        scrollPane.setPreferredSize(new Dimension(getWidth(), 0));

        setMinimumSize(new Dimension(0, titleBar.getMinimumSize().height));

        final MigLayout mig = new MigLayout();
        mig.setLayoutConstraints("flowy, insets 0, gap 0");
        mig.setColumnConstraints("[fill, grow]");
        mig.setRowConstraints("[][fill, grow]");
        setLayout(mig);
        add(titleBar);
        add(scrollPane);

    }
 
源代码10 项目: xdm   文件: Page.java
public Page(String title, int width, XDMFrame parent) {
	setOpaque(false);
	setLayout(null);
	this.title = title;
	this.width = width;
	this.parent = parent;
	bgColor = new Color(0, 0, 0, Config.getInstance().isNoTransparency()?255:200);
	MouseInputAdapter ma = new MouseInputAdapter() {
	};

	addMouseListener(ma);
	addMouseMotionListener(ma);

	jsp = new JScrollPane();
	jsp.setOpaque(false);
	jsp.setBorder(null);
	jsp.getViewport().setOpaque(false);

	DarkScrollBar scrollBar = new DarkScrollBar(JScrollBar.VERTICAL);
	jsp.setVerticalScrollBar(scrollBar);
	jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	jsp.getVerticalScrollBar().setUnitIncrement(getScaledInt(10));
	jsp.getVerticalScrollBar().setBlockIncrement(getScaledInt(25));

	add(jsp);

	registerMouseListener();

	init();

}
 
源代码11 项目: magarena   文件: ImageSetsPanel.java
ImageSetsPanel(final AvatarImagesScreen screen) {

        // List of avatar image sets.
        final JList<AvatarImageSet> imageSetsList = new JList<>(getAvatarImageSetsArray());
        imageSetsList.setOpaque(false);
        imageSetsList.addListSelectionListener(e -> {
            if (!e.getValueIsAdjusting()) {
                SwingUtilities.invokeLater(() -> {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    screen.displayImageSetIcons(imageSetsList.getSelectedValue());
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                });
            }
        });
        imageSetsList.setSelectedIndex(0);

        final AvatarListCellRenderer renderer = new AvatarListCellRenderer();
        imageSetsList.setCellRenderer(renderer);

        final JScrollPane scrollPane = new JScrollPane();
        scrollPane.setViewportView(imageSetsList);
        scrollPane.setBorder(BorderFactory.createEmptyBorder());
        scrollPane.setOpaque(false);
        scrollPane.getViewport().setOpaque(false);

        setLayout(new MigLayout("insets 0, gap 0, flowy"));
        setBorder(FontsAndBorders.BLACK_BORDER);
        add(scrollPane, "w 100%, h 100%");

        refreshStyle();
    }
 
源代码12 项目: netbeans   文件: ResetResultsProfilingPoint.java
private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                Utils.openLocation(ResetResultsProfilingPoint.this.getLocation());
            }
        };

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea();

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.ResetResultsProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
源代码13 项目: gameserver   文件: UserBagDialog.java
public UserBagDialog(User user) {
		this.user = user;
		this.bag  = user.getBag();
		
		currCountTf.setText(String.valueOf(bag.getCurrentCount()));
		currCountTf.setEnabled(true);
		maxCountTf.setText(String.valueOf(bag.getMaxCount()));
		maxCountTf.setEnabled(true);

		DefaultListModel listModel = new DefaultListModel();
		bagList.setModel(listModel);
		bagList.setCellRenderer(new PropDataListCellRenderer());
		bagList.setDragEnabled(true);
		bagList.setHighlighters(HighlighterFactory.createAlternateStriping());
		bagList.addMouseListener(new MouseAdapter() {

			/* (non-Javadoc)
			 * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
			 */
			@Override
			public void mouseClicked(MouseEvent e) {
				if ( e.getClickCount() == 2 ) {
					commandWearItem();
				}
			}
			
		});
		JScrollPane bagPane = new JScrollPane(bagList);
		bagPane.setBorder(BorderFactory.createTitledBorder("玩家当前背包内容"));
		
		updateBagStatus();
		updateWearStatus();
		updateUserStatus();
		
//		this.setBorder(BorderFactory.createTitledBorder("玩家" + user.getUsername() + "背包数据"));
		this.setLayout(new MigLayout("ins 10px"));
		this.add(currCountLbl, "");
		this.add(currCountTf, "gapright 10px");
		this.add(maxCountLbl, "");
		this.add(maxCountTf, "wrap");
		
		this.add(bagPane, "dock east, width 30%, height 100%, wrap");
		JXPanel wearPanel = new JXPanel();
		wearPanel.setLayout(new MigLayout("wrap 4"));
		for ( int i=1; i<wearBtns.length; i++ ) {
			if ( i % 4 == 0 ) {
				wearPanel.add(wearBtns[i], "sg wear, wrap, height 36px");
			} else {
				wearPanel.add(wearBtns[i], "sg wear, height 36px");
			}
		}
		this.add(wearPanel, "span, align center");
		
		this.addNewItemToBagBtn.setActionCommand(COMMAND_ADD_NEW);
		this.removeItemFromBagBtn.setActionCommand(COMMAND_REMOVE_ITEM);
		this.wearBagItemBtn.setActionCommand(COMMAND_WEAR_ITEM);
		this.modiBagItemBtn.setActionCommand(COMMAND_MODIFY_ITEM);
		
		this.okButton.setActionCommand(ActionName.OK.name());
		this.cancelButton.setActionCommand(ActionName.CANCEL.name());
		
		this.addNewItemToBagBtn.addActionListener(this);
		this.removeItemFromBagBtn.addActionListener(this);
		this.wearBagItemBtn.addActionListener(this);
		this.modiBagItemBtn.addActionListener(this);
		this.okButton.addActionListener(this);
		this.cancelButton.addActionListener(this);
		
		JXPanel btnPanel = new JXPanel();
		btnPanel.setLayout(new MigLayout("wrap 4"));
		btnPanel.add(addNewItemToBagBtn, "sg btn");
		btnPanel.add(removeItemFromBagBtn, "sg btn");
		btnPanel.add(wearBagItemBtn, "sg btn");
		btnPanel.add(modiBagItemBtn, "sg btn, wrap");
		btnPanel.add(okButton, "span, split 2, align center");
		btnPanel.add(cancelButton, "");
		
		this.userStatusLbl.setBackground(Color.WHITE);
		this.userStatusLbl.setFont(MainFrame.BIG_FONT);
		this.userStatusLbl.setHorizontalTextPosition(JLabel.CENTER);
		this.userStatusLbl.setBorder(BorderFactory.createEtchedBorder());

		
		this.add(userStatusLbl, "newline, span, width 70%, height 100px, align center, wrap");
		this.add(btnPanel, "dock south, span, align center");
		
		this.setModal(true);
		this.setSize(800, 600);
		Point p = WindowUtils.getPointForCentering(this);
		this.setLocation(p);
	}
 
源代码14 项目: bigtable-sql   文件: ResultTab.java
private void createGUI()
{
	setLayout(new BorderLayout());

     int sqlResultsTabPlacement = _session.getProperties().getSQLResultsTabPlacement();
     _tabResultTabs = UIFactory.getInstance().createTabbedPane(sqlResultsTabPlacement);

	JPanel panel1 = new JPanel();
	JPanel panel2 = new JPanel();
	panel2.setLayout(new GridLayout(1, 3, 0, 0));

     panel2.add(_readMoreResultsHandler.getLoadingLabel());
     panel2.add(new TabButton(getRerunCurrentSQLResultTabAction()));
     panel2.add(new TabButton(new FindInResultAction(_session.getApplication())));
	panel2.add(new TabButton(new CreateResultTabFrameAction(_session.getApplication())));
	panel2.add(new TabButton(new CloseAction()));
	panel1.setLayout(new BorderLayout());
	panel1.add(panel2, BorderLayout.EAST);
	panel1.add(_currentSqlLblCtrl.getLabel(), BorderLayout.CENTER);
	add(panel1, BorderLayout.NORTH);
	add(_tabResultTabs, BorderLayout.CENTER);

      //  SCROLL _resultSetSp.setBorder(BorderFactory.createEmptyBorder());
     
     // i18n[ResultTab.resultsTabTitle=Results]
     String resultsTabTitle = 
         s_stringMgr.getString("ResultTab.resultsTabTitle");
     _tabResultTabs.addTab(resultsTabTitle, _dataSetViewerFindDecorator.getComponent()); //  SCROLL

     if (_session.getProperties().getShowResultsMetaData())
     {
        _metaDataSp.setBorder(BorderFactory.createEmptyBorder());
        
        // i18n[ResultTab.metadataTabTitle=MetaData]
        String metadataTabTitle = 
            s_stringMgr.getString("ResultTab.metadataTabTitle");
        _tabResultTabs.addTab(metadataTabTitle, _metaDataSp);
     }

	final JScrollPane sp = new JScrollPane(_queryInfoPanel);
	sp.setBorder(BorderFactory.createEmptyBorder());
       
       // i18n[ResultTab.infoTabTitle=Info]
       String infoTabTitle = 
           s_stringMgr.getString("ResultTab.infoTabTitle");
	_tabResultTabs.addTab(infoTabTitle, sp);


     reInitOverview();

}
 
源代码15 项目: thunderstorm   文件: AnalysisOptionsDialog.java
private void addComponentsToPane() {
    JPanel pane = new JPanel();
    //
    pane.setLayout(new GridBagLayout());
    GridBagConstraints componentConstraints = new GridBagConstraints();
    componentConstraints.gridx = 0;
    componentConstraints.fill = GridBagConstraints.BOTH;
    componentConstraints.weightx = 1;

    JPanel cameraPanel = new JPanel(new BorderLayout());
    cameraPanel.add(cameraSetup);
    cameraPanel.setBorder(BorderFactory.createTitledBorder("Camera"));
    pane.add(cameraPanel, componentConstraints);
    JPanel p = filtersPanel.getPanel("Filter:");
    p.setBorder(BorderFactory.createTitledBorder("Image filtering"));
    pane.add(p, componentConstraints);
    p = detectorsPanel.getPanel("Method:");
    p.setBorder(BorderFactory.createTitledBorder("Approximate localization of molecules"));
    pane.add(p, componentConstraints);
    p = estimatorsPanel.getPanel("Method:");
    p.setBorder(BorderFactory.createTitledBorder("Sub-pixel localization of molecules"));
    pane.add(p, componentConstraints);
    p = renderersPanel.getPanel("Method:");
    p.setBorder(BorderFactory.createTitledBorder("Visualisation of the results"));
    pane.add(p, componentConstraints);
    //
    defaults.addActionListener(this);
    preview.addActionListener(this);
    ok.addActionListener(this);
    cancel.addActionListener(this);
    //
    JPanel buttons = new JPanel();
    buttons.add(defaults);
    buttons.add(Box.createHorizontalStrut(30));
    buttons.add(preview);
    buttons.add(Box.createHorizontalStrut(30));
    buttons.add(ok);
    buttons.add(cancel);
    pane.add(buttons, componentConstraints);
    pane.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20));
    JScrollPane scrollPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    add(scrollPane);
    getRootPane().setDefaultButton(ok);
    pack();
    int maxScreenHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().height;
    if(getHeight() > maxScreenHeight) {
        setSize(getWidth(), maxScreenHeight);
    }
}
 
源代码16 项目: OpenDA   文件: Query.java
/** Construct a panel with no entries in it.
 */
public Query() {
    _grid = new GridBagLayout();
    _constraints = new GridBagConstraints();
    _constraints.fill = GridBagConstraints.HORIZONTAL;

    // If the next line is commented out, then the PtolemyApplet
    // model parameters will have an entry that is less than one
    // character wide unless the window is made to be fairly large.
    _constraints.weightx = 1.0;
    _constraints.anchor = GridBagConstraints.NORTHWEST;
    _entryPanel.setLayout(_grid);
    // It's not clear whether the following has any real significance...
    // _entryPanel.setOpaque(true);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    _entryPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    // Add a message panel into which a message can be placed using
    // setMessage().
    _messageArea = new JTextArea("");
    _messageArea.setFont(new Font("SansSerif", Font.PLAIN, 12));
    _messageArea.setEditable(false);
    _messageArea.setLineWrap(true);
    _messageArea.setWrapStyleWord(true);

    // It seems like setLineWrap is somewhat broken.  Really,
    // setLineWrap works best with scrollbars.  We have
    // a couple of choices: use scrollbars or hack in something
    // that guesses the number of lines.  Note that to
    // use scrollbars, the tutorial at
    // http://java.sun.com/docs/books/tutorial/uiswing/components/simpletext.html#textarea
    // suggests: "If you put a text area in a scroll pane, be
    // sure to set the scroll pane's preferred size or use a
    // text area constructor that sets the number of rows and
    // columns for the text area."

    _messageArea.setBackground(null);

    _messageArea.setAlignmentX(Component.LEFT_ALIGNMENT);

    _messageScrollPane = new JScrollPane(_messageArea);
    _messageScrollPane.setVerticalScrollBarPolicy(
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    // Get rid of the border.
    _messageScrollPane.setBorder(BorderFactory.createEmptyBorder());
    _messageScrollPane.getViewport().setBackground(null);

    // Useful for debugging:
    //_messageScrollPane.setBorder(
    //                    BorderFactory.createLineBorder(Color.pink));

    // We add the _messageScrollPane when we first use it.

    _entryScrollPane = new JScrollPane(_entryPanel);
    // Get rid of the border.
    _entryScrollPane.setBorder(BorderFactory.createEmptyBorder());
    _entryScrollPane.getViewport().setBackground(null);
    _entryScrollPane.setBackground(null);
    add(_entryScrollPane);

    // Setting the background to null allegedly means it inherits the
    // background color from the container.
    _entryPanel.setBackground(null);
}
 
源代码17 项目: FancyBing   文件: GtpShell.java
public GtpShell(Frame owner, Listener listener,
                MessageDialogs messageDialogs)
{
    super(owner, i18n("TIT_SHELL"));
    m_messageDialogs = messageDialogs;
    m_listener = listener;
    Preferences prefs = Preferences.userNodeForPackage(getClass());
    m_historyMin = prefs.getInt("history-min", 2000);
    m_historyMax = prefs.getInt("history-max", 3000);
    JPanel panel = new JPanel(new BorderLayout());
    getContentPane().add(panel, BorderLayout.CENTER);
    m_gtpShellText = new GtpShellText(m_historyMin, m_historyMax, false);
    CaretListener caretListener = new CaretListener()
        {
            public void caretUpdate(CaretEvent event)
            {
                if (m_listener == null)
                    return;
                // Call the callback only if the selected text has changed.
                // This avoids that the callback is called multiple times
                // if the caret position changes, but the text selection
                // was null before and after the change (see also bug
                // #2964755)
                String selectedText = m_gtpShellText.getSelectedText();
                if (! ObjectUtil.equals(selectedText, m_selectedText))
                {
                    m_listener.textSelected(selectedText);
                    m_selectedText = selectedText;
                }
            }
        };
    m_gtpShellText.addCaretListener(caretListener);
    m_scrollPane =
        new JScrollPane(m_gtpShellText,
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    if (Platform.isMac())
        // Default Apple L&F uses no border, but Quaqua 3.7.4 does
        m_scrollPane.setBorder(null);
    panel.add(m_scrollPane, BorderLayout.CENTER);
    panel.add(createCommandInput(), BorderLayout.SOUTH);
    setMinimumSize(new Dimension(160, 112));
    pack();
}
 
源代码18 项目: ganttproject   文件: DateIntervalListEditor.java
public DateIntervalListEditor(final DateIntervalModel intervalsModel) {
  super(new BorderLayout());
  myIntervalsModel = intervalsModel;
  myStart = new DefaultDateOption("generic.startDate") {
    @Override
    public void setValue(Date value) {
      super.setValue(value);
      if (intervalsModel.getMaxIntervalLength() == 1) {
        DateIntervalListEditor.this.myFinish.setValue(value);
      }
      DateIntervalListEditor.this.updateActions();
    }
  };
  myFinish = new DefaultDateOption("generic.endDate") {
    @Override
    public void setValue(Date value) {
      super.setValue(value);
      DateIntervalListEditor.this.updateActions();
    }
  };
  myAddAction = new GPAction("add") {
    @Override
    public void actionPerformed(ActionEvent e) {
      myIntervalsModel.add(DateInterval.createFromVisibleDates(myStart.getValue(), myFinish.getValue()));
      myListModel.update();
    }
  };
  myDeleteAction = new GPAction("delete") {
    @Override
    public void actionPerformed(ActionEvent e) {
      int selected = myListSelectionModel.getMinSelectionIndex();
      myIntervalsModel.remove(myIntervalsModel.getIntervals()[selected]);
      myListModel.update();
      myListSelectionModel.removeIndexInterval(selected, selected);
      updateActions();
    }
  };
  JPanel topPanel = new JPanel(new BorderLayout());
  OptionsPageBuilder builder = new OptionsPageBuilder();
  builder.setOptionKeyPrefix("");
  GPOptionGroup group = myIntervalsModel.getMaxIntervalLength() == 1 ? new GPOptionGroup("",
      new GPOption[] { myStart }) : new GPOptionGroup("", new GPOption[] { myStart, myFinish });
  group.setTitled(false);
  JComponent datesBox = builder.buildPlanePage(new GPOptionGroup[] { group });
  topPanel.add(datesBox, BorderLayout.CENTER);

  Box buttonBox = Box.createHorizontalBox();
  buttonBox.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
  buttonBox.add(new JButton(myAddAction));
  buttonBox.add(Box.createHorizontalStrut(5));
  buttonBox.add(new JButton(myDeleteAction));
  topPanel.add(buttonBox, BorderLayout.SOUTH);
  topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  add(topPanel, BorderLayout.NORTH);

  JList list = new JList(myListModel);
  list.setName("list");
  list.setBorder(BorderFactory.createLoweredBevelBorder());
  myListSelectionModel = list.getSelectionModel();
  myListSelectionModel.addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      updateActions();
    }
  });
  JScrollPane scrollPane = new JScrollPane(list);
  scrollPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  scrollPane.setPreferredSize(new Dimension(120, 200));
  add(scrollPane, BorderLayout.CENTER);
  updateActions();
}
 
源代码19 项目: rapidminer-studio   文件: RepositoryBrowser.java
/**
 * @param dragListener
 *            registers a dragListener at the repository tree transferhandler. The listener is
 *            informed when a drag starts and a drag ends.
 */
public RepositoryBrowser(DragListener dragListener) {
	tree = new RepositoryTree();
	if (dragListener != null) {
		((AbstractPatchedTransferHandler) tree.getTransferHandler()).addDragListener(dragListener);
	}
	tree.addRepositorySelectionListener(e -> {

		Entry entry = e.getEntry();

		// skip folder double-clicks
		if (!(entry instanceof Folder)) {
			OpenAction.open((DataEntry) entry, true);
		}
	});

	setLayout(new BorderLayout());

	furtherActionsMenu.add(ADD_REPOSITORY_ACTION);
	furtherActionsMenu.addSeparator();
	furtherActionsMenu.add(tree.CREATE_FOLDER_ACTION);
	furtherActionsMenu.add(tree.REFRESH_ACTION);
	furtherActionsMenu.addSeparator();
	final JMenu sortActionsMenu = new JMenu(SORT_REPOSITORY_ACTION);
	sortActionsMenu.add(tree.SORT_BY_NAME_ACTION.createMenuItem());
	sortActionsMenu.add(tree.SORT_BY_LAST_MODIFIED_DATE_ACTION.createMenuItem());
	furtherActionsMenu.add(sortActionsMenu);
	furtherActionsMenu.add(tree.SHOW_PROCESS_IN_REPOSITORY_ACTION);

	JPanel northPanel = new JPanel(new GridBagLayout());
	northPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.insets = new Insets(2, 2, 2, 2);

	JButton addDataButton = new JButton(new ImportDataAction(true));
	addDataButton.setPreferredSize(new Dimension(100, 30));
	northPanel.add(addDataButton, c);

	DropDownPopupButton furtherActionsButton = new DropDownPopupButton("gui.action.further_repository_actions",
			() -> furtherActionsMenu);
	furtherActionsButton.setPreferredSize(new Dimension(50, 30));

	c.gridx = 1;
	c.gridy = 0;
	c.weightx = 0;
	northPanel.add(furtherActionsButton, c);

	add(northPanel, BorderLayout.NORTH);
	JScrollPane scrollPane = new ExtendedJScrollPane(tree);
	scrollPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Colors.TEXTFIELD_BORDER));
	add(scrollPane, BorderLayout.CENTER);
}
 
源代码20 项目: Astrosoft   文件: VimDasaView.java
public VimDasaView(String title, Vimshottari v) {
	
	super(title, viewSize);
	this.v = v;
	Font treeFont = UIUtil.getFont("Tahoma", Font.PLAIN, 11);
	Font tableFont = UIUtil.getFont(Font.BOLD, 12);
	
	JTree dasaTree = new JTree(v.getDasaTreeModel());
	dasaTree.setFont(treeFont);
	
	dasaTree.getSelectionModel().setSelectionMode
        (TreeSelectionModel.SINGLE_TREE_SELECTION);
	
	dasaTree.setCellRenderer(new DasaTreeCellRenderer());
	ToolTipManager.sharedInstance().registerComponent(dasaTree);
	
	JScrollPane treePane = new JScrollPane(dasaTree);
	treePane.setPreferredSize(treeSize);
	
	dasaTableModel = new AstrosoftTableModel(
			v.getVimDasaTableData(), Vimshottari.getVimDasaTableColumnMetaData());
	dasaTable = new AstrosoftTable(dasaTableModel, TableStyle.SCROLL_SINGLE_ROW_SELECT);
	
	dasaTable.getTableHeader().setFont(tableFont);
	dasaTable.getSelectionModel().setLeadSelectionIndex(-1);

	dasaTitle = new TitleLabel(DisplayStrings.VIM_DASA_STR);

	JPanel dasaPanel = new JPanel();
	dasaPanel.add(new TitledTable(dasaTitle, dasaTable, tableSize));
	
	JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treePane, dasaPanel);
	
	//splitPane.setBackground(Color.WHITE);
	treePane.setBorder(BorderFactory.createEtchedBorder());
	dasaPanel.setBorder(BorderFactory.createEmptyBorder());
	splitPane.setBorder(BorderFactory.createEtchedBorder());
	
	add(splitPane,BorderLayout.CENTER);
	
	this.setVisible(true);
	
	//Make Current Dasa as Selected
	TreePath currentDasaPath = v.getCurrentDasaPath();
	dasaTree.setSelectionPath(currentDasaPath);
	
	DefaultMutableTreeNode currentDasaNode = (DefaultMutableTreeNode) dasaTree.getLastSelectedPathComponent();
	
	nodeSelected(currentDasaNode, currentDasaPath);
	
	dasaTree.addTreeSelectionListener(new DasaTreeListener(this));
}