Java Code Examples for javax.swing.JScrollPane#setVisible()

The following examples show how to use javax.swing.JScrollPane#setVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerTest.java    From Java-MP3-player with MIT License 6 votes vote down vote up
void Player() {
	contentPane = new ImagePanel();
	setBounds(100, 100, 538, 354);

	this.setVisible(true);
	setContentPane(contentPane);
	contentPane.setLayout(null);
	pane = new JScrollPane(PlayList);
	pane.setVisible(false);

	contentPane.setBackground(new Color(0, 0, 128));
	panel = new JPanel();
	panel.setBounds(0, 214, 511, 110);

	control_panel = new JPanelsSliding();
	control_panel.setLocation(0, 217);
	control_panel.setSize(535, 107);
	control_panel.setLayout(new CardLayout(0, 0));
	control_panel.add(panel, "name_37092408351471");

	contentPane.add(control_panel);
}
 
Example 2
Source File: mxCellEditor.java    From blog-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
public mxCellEditor(mxGraphComponent graphComponent)
{
	this.graphComponent = graphComponent;

	// Creates the plain text editor
	textArea = new JTextArea();
	textArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
	textArea.setOpaque(false);

	// Creates the HTML editor
	editorPane = new JEditorPane();
	editorPane.setOpaque(false);
	editorPane.setBackground(new Color(0,0,0,0));
	editorPane.setContentType("text/html");

	// Workaround for inserted linefeeds in HTML markup with
	// lines that are longar than 80 chars
	editorPane.setEditorKit(new NoLinefeedHtmlEditorKit());

	// Creates the scollpane that contains the editor
	// FIXME: Cursor not visible when scrolling
	scrollPane = new JScrollPane();
	scrollPane.setBorder(BorderFactory.createEmptyBorder());
	scrollPane.getViewport().setOpaque(false);
	scrollPane.setVisible(false);
	scrollPane.setOpaque(false);

	// Installs custom actions
	editorPane.getActionMap().put(CANCEL_EDITING, cancelEditingAction);
	textArea.getActionMap().put(CANCEL_EDITING, cancelEditingAction);
	editorPane.getActionMap().put(SUBMIT_TEXT, textSubmitAction);
	textArea.getActionMap().put(SUBMIT_TEXT, textSubmitAction);

	// Remembers the action map key for the enter keystroke
	editorEnterActionMapKey = editorPane.getInputMap().get(enterKeystroke);
	textEnterActionMapKey = editorPane.getInputMap().get(enterKeystroke);
}
 
Example 3
Source File: EditorPaneWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates a new instance of EditorPaneWidget 
 * @param scene 
 * @param text 
 * @param contentType 
 */
public EditorPaneWidget(Scene scene, String text, String contentType) {
    super(scene);
    editorPane = new JEditorPane(contentType,text);
    scrollPane = new JScrollPane(editorPane);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    editorPane.setVisible(false);
    scrollPane.setVisible(false);
    componentAdded = false;
    origoinalFontSize = editorPane.getFont().getSize2D();
    editorPane.setMaximumSize(new Dimension(0,(int)origoinalFontSize*6));
    componentListener = new ComponentComponentListener ();
}
 
Example 4
Source File: PageFlowView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private synchronized PageFlowScene initializeScene() {
    if (getScene() == null) {
        setLayout(new BorderLayout());
        setScene(new PageFlowScene(this));
        getScene().setAccessibleContext(this.getAccessibleContext());

        JScrollPane pane = new JScrollPane(getScene().createView());
        pane.setVisible(true);
        add(pane, BorderLayout.CENTER);
        setDefaultActivatedNode();
    }

    return getScene();
}
 
Example 5
Source File: PanamaHitek_DataBuffer.java    From PanamaHitek_Arduino with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Construye un JTable y la inserta dentro de un JPanel
 *
 * @param panel JPanel donde se desea insertar la tabla
 */
public void insertToPanel(JPanel panel) {
    buildTable();
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    scroll = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);;
    scroll.setViewportView(table);
    scroll.setVisible(true);
    scroll.setBounds(0, 0, panel.getWidth(), panel.getHeight() - 25);
    tableFlag = true;
    panel.add(scroll);
}
 
Example 6
Source File: PerfMonGui.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Override
protected JPanel getGraphPanelContainer() {
    JPanel panel = new JPanel(new BorderLayout());
    JPanel innerTopPanel = new JPanel(new BorderLayout());

    errorPane = new JScrollPane();
    errorPane.setMinimumSize(new Dimension(100, 50));
    errorPane.setPreferredSize(new Dimension(100, 50));

    errorTextArea = new JTextArea();
    errorTextArea.setForeground(Color.red);
    errorTextArea.setBackground(new Color(255, 255, 153));
    errorTextArea.setEditable(false);
    errorPane.setViewportView(errorTextArea);

    registerPopup();

    innerTopPanel.add(createConnectionsPanel(), BorderLayout.NORTH);
    innerTopPanel.add(errorPane, BorderLayout.SOUTH);
    innerTopPanel.add(getFilePanel(), BorderLayout.CENTER);

    panel.add(innerTopPanel, BorderLayout.NORTH);

    errorPane.setVisible(false);

    return panel;
}
 
Example 7
Source File: GrandExchangeSearchPanel.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
GrandExchangeSearchPanel(final ClientThread clientThread, final ItemManager itemManager, final ScheduledExecutorService executor)
{
	this.clientThread = clientThread;
	this.itemManager = itemManager;
	this.executor = executor;

	setLayout(new BorderLayout());
	setBackground(ColorScheme.DARK_GRAY_COLOR);

	/*  The main container, this holds the search bar and the center panel */
	JPanel container = new JPanel();
	container.setLayout(new BorderLayout(5, 5));
	container.setBorder(new EmptyBorder(10, 10, 10, 10));
	container.setBackground(ColorScheme.DARK_GRAY_COLOR);

	searchBar.setIcon(IconTextField.Icon.SEARCH);
	searchBar.setPreferredSize(new Dimension(100, 30));
	searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR);
	searchBar.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR);
	searchBar.addActionListener(e -> executor.execute(() -> priceLookup(false)));
	searchBar.addClearListener(this::updateSearch);

	searchItemsPanel.setLayout(new GridBagLayout());
	searchItemsPanel.setBackground(ColorScheme.DARK_GRAY_COLOR);

	constraints.fill = GridBagConstraints.HORIZONTAL;
	constraints.weightx = 1;
	constraints.gridx = 0;
	constraints.gridy = 0;

	/* This panel wraps the results panel and guarantees the scrolling behaviour */
	JPanel wrapper = new JPanel(new BorderLayout());
	wrapper.setBackground(ColorScheme.DARK_GRAY_COLOR);
	wrapper.add(searchItemsPanel, BorderLayout.NORTH);

	/*  The results wrapper, this scrolling panel wraps the results container */
	JScrollPane resultsWrapper = new JScrollPane(wrapper);
	resultsWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR);
	resultsWrapper.getVerticalScrollBar().setPreferredSize(new Dimension(12, 0));
	resultsWrapper.getVerticalScrollBar().setBorder(new EmptyBorder(0, 5, 0, 0));
	resultsWrapper.setVisible(false);

	/* This panel wraps the error panel and limits its height */
	JPanel errorWrapper = new JPanel(new BorderLayout());
	errorWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR);
	errorWrapper.add(errorPanel, BorderLayout.NORTH);

	errorPanel.setContent("Grand Exchange Search",
		"Here you can search for an item by its name to find price information.");

	centerPanel.add(resultsWrapper, RESULTS_PANEL);
	centerPanel.add(errorWrapper, ERROR_PANEL);

	cardLayout.show(centerPanel, ERROR_PANEL);

	container.add(searchBar, BorderLayout.NORTH);
	container.add(centerPanel, BorderLayout.CENTER);

	add(container, BorderLayout.CENTER);
}
 
Example 8
Source File: GrandExchangeSearchPanel.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
GrandExchangeSearchPanel(ClientThread clientThread, ItemManager itemManager, ScheduledExecutorService executor)
{
	this.clientThread = clientThread;
	this.itemManager = itemManager;
	this.executor = executor;

	setLayout(new BorderLayout());
	setBackground(ColorScheme.DARK_GRAY_COLOR);

	/*  The main container, this holds the search bar and the center panel */
	JPanel container = new JPanel();
	container.setLayout(new BorderLayout(5, 5));
	container.setBorder(new EmptyBorder(10, 10, 10, 10));
	container.setBackground(ColorScheme.DARK_GRAY_COLOR);

	searchBar.setIcon(IconTextField.Icon.SEARCH);
	searchBar.setPreferredSize(new Dimension(100, 30));
	searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR);
	searchBar.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR);
	searchBar.addActionListener(e -> executor.execute(() -> priceLookup(false)));
	searchBar.addClearListener(this::updateSearch);

	searchItemsPanel.setLayout(new GridBagLayout());
	searchItemsPanel.setBackground(ColorScheme.DARK_GRAY_COLOR);

	constraints.fill = GridBagConstraints.HORIZONTAL;
	constraints.weightx = 1;
	constraints.gridx = 0;
	constraints.gridy = 0;

	/* This panel wraps the results panel and guarantees the scrolling behaviour */
	JPanel wrapper = new JPanel(new BorderLayout());
	wrapper.setBackground(ColorScheme.DARK_GRAY_COLOR);
	wrapper.add(searchItemsPanel, BorderLayout.NORTH);

	/*  The results wrapper, this scrolling panel wraps the results container */
	JScrollPane resultsWrapper = new JScrollPane(wrapper);
	resultsWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR);
	resultsWrapper.getVerticalScrollBar().setPreferredSize(new Dimension(12, 0));
	resultsWrapper.getVerticalScrollBar().setBorder(new EmptyBorder(0, 5, 0, 0));
	resultsWrapper.setVisible(false);

	/* This panel wraps the error panel and limits its height */
	JPanel errorWrapper = new JPanel(new BorderLayout());
	errorWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR);
	errorWrapper.add(errorPanel, BorderLayout.NORTH);

	errorPanel.setContent("Grand Exchange Search",
		"Here you can search for an item by its name to find price information.");

	centerPanel.add(resultsWrapper, RESULTS_PANEL);
	centerPanel.add(errorWrapper, ERROR_PANEL);

	cardLayout.show(centerPanel, ERROR_PANEL);

	container.add(searchBar, BorderLayout.NORTH);
	container.add(centerPanel, BorderLayout.CENTER);

	add(container, BorderLayout.CENTER);
}
 
Example 9
Source File: ChipsterAnnotationsScreen.java    From chipster with MIT License 4 votes vote down vote up
@SuppressWarnings("serial")
public ChipsterAnnotationsScreen(AnnotationManager annotations) {

	
	SwingClientApplication.setPlastic3DLookAndFeel(frame);
	frame.setPreferredSize(new Dimension(640, 480));

	frame.setLocationByPlatform(true);

	this.annotations = annotations;
	
	table = this.getTable();

	// Blue selection causes lot of visual problems, and there isn't
	// any meening for the selection
	table.setSelectionBackground(table.getBackground());
	table.setSelectionForeground(table.getForeground());

	JScrollPane tableScroller = new JScrollPane(table);
	closeButton = new JButton("Close");
	closeButton.addActionListener(this);
	closeButton.setPreferredSize(BUTTON_SIZE);

	detailsScroller = new JScrollPane(detailsTextArea);
	detailsButton = new JButton("Show Details");

	// to make sure that details get enough area
	detailsScroller.setMinimumSize(new Dimension(0, 200));
	detailsScroller.setVisible(false);
	detailsTextArea.setEditable(false);

	detailsButton.addActionListener(this);

	detailsButton.setPreferredSize(BUTTON_SIZE);

	detailsButton.setEnabled(false);

	frame.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.anchor = GridBagConstraints.NORTHWEST;
	c.gridx = 0;
	c.gridy = 0;
	c.gridwidth = 4;
	c.fill = GridBagConstraints.BOTH;
	c.weightx = 1.0;
	c.weighty = 1.0;
	frame.add(tableScroller, c);

	c.gridy++;
	// c.gridx=3;
	c.gridwidth = GridBagConstraints.REMAINDER;
	c.weightx = 0.0;
	c.weighty = 0.0;
	c.fill = GridBagConstraints.NONE;
	c.anchor = GridBagConstraints.LINE_END;
	c.insets.bottom = 8;
	c.insets.right = 8;
	c.insets.top = 8;

	frame.add(closeButton, c);

	frame.pack();
}