下面列出了javax.swing.JScrollPane#setVisible ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
/**
*
*/
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);
}
/** 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 ();
}
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();
}
/**
* 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);
}
@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;
}
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);
}
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);
}
@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();
}