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

The following examples show how to use javax.swing.JScrollPane#setOpaque() . 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: VectorEditorPanel.java    From SVG-Android with Apache License 2.0 7 votes vote down vote up
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);
}
 
Example 2
Source File: SparkToaster.java    From Spark with Apache License 2.0 6 votes vote down vote up
/**
 * Show a toaster with the specified message and the associated icon.
 *
 * @param icon Icon to show in toaster popup.
 * @param msg Message to show in toaster popup.
 */
public void showToaster(Icon icon, String msg) {
    SingleToaster singleToaster = new SingleToaster();
    final JScrollPane pane = new JScrollPane(singleToaster.message);
    pane.setOpaque(false);
    pane.setBorder(BorderFactory.createEmptyBorder());
    pane.getViewport().setBackground(Color.white);
    mainPanel.add(pane, new GridBagConstraints(1, 2, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 5), 0, 0));


    if (icon != null) {
        titleLabel.setIcon(icon);
    }
    if (ModelUtil.hasLength(msg) && msg.startsWith("/me ")) {
        msg = msg.replaceFirst("/me", getTitle());
        singleToaster.message.setForeground(Color.MAGENTA);
    }
    singleToaster.message.setText(msg);
    singleToaster.message.setCaretPosition(0);
    singleToaster.animate();
    window = singleToaster;
}
 
Example 3
Source File: MLTPaneProvider.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public JScrollPane get() {
  JPanel panel = new JPanel();
  panel.setOpaque(false);
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

  panel.add(initMltParamsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initAnalyzerNamePanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initFieldsSettingsPanel());

  JScrollPane scrollPane = new JScrollPane(panel);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  return scrollPane;
}
 
Example 4
Source File: QueryParserPaneProvider.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public JScrollPane get() {
  JPanel panel = new JPanel();
  panel.setOpaque(false);
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

  panel.add(initSelectParserPane());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initParserSettingsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initPhraseQuerySettingsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initFuzzyQuerySettingsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initDateRangeQuerySettingsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initPointRangeQuerySettingsPanel());

  JScrollPane scrollPane = new JScrollPane(panel);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  return scrollPane;
}
 
Example 5
Source File: AnalyzerPaneProvider.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public JScrollPane get() {
  JPanel panel = new JPanel();
  panel.setOpaque(false);
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

  panel.add(initAnalyzerNamePanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initAnalysisChainPanel());

  tokenizerTF.setEditable(false);

  JScrollPane scrollPane = new JScrollPane(panel);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  return scrollPane;
}
 
Example 6
Source File: AddDocumentDialogFactory.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JPanel footer() {
  JPanel panel = new JPanel(new GridLayout(1, 1));
  panel.setOpaque(false);
  panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

  JScrollPane scrollPane = new JScrollPane(infoTA);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  panel.add(scrollPane);
  return panel;
}
 
Example 7
Source File: SwingUtils.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public static void makeTransparant(JTable table, JScrollPane scrollPane) {
	table.setOpaque(false);
	((DefaultTableCellRenderer)table.getDefaultRenderer(Object.class)).setOpaque(false);
	((DefaultTableCellRenderer)table.getDefaultRenderer(String.class)).setOpaque(false);
	((JComponent)table.getDefaultRenderer(Boolean.class)).setOpaque(false);
	((DefaultTableCellRenderer)table.getDefaultRenderer(Integer.class)).setOpaque(false);
	
	scrollPane.setOpaque(false);
	scrollPane.getViewport().setOpaque(false);
}
 
Example 8
Source File: FieldValuesPaneProvider.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public JScrollPane get() {
  JPanel panel = new JPanel();
  panel.setOpaque(false);
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

  panel.add(initFieldsConfigPanel());

  JScrollPane scrollPane = new JScrollPane(panel);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  return scrollPane;
}
 
Example 9
Source File: SortPaneProvider.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public JScrollPane get() {
  JPanel panel = new JPanel(new GridLayout(1, 1));
  panel.setOpaque(false);
  panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

  panel.add(initSortConfigsPanel());

  JScrollPane scrollPane = new JScrollPane(panel);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  return scrollPane;
}
 
Example 10
Source File: SimilarityPaneProvider.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public JScrollPane get() {
  JPanel panel = new JPanel();
  panel.setOpaque(false);
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

  panel.add(initSimilaritySettingsPanel());

  JScrollPane scrollPane = new JScrollPane(panel);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  return scrollPane;
}
 
Example 11
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 12
Source File: DocValuesDialogFactory.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JPanel content() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.setOpaque(false);
  panel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
  panel.add(headerPanel(), BorderLayout.PAGE_START);
  JScrollPane scrollPane = new JScrollPane(valueList());
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  panel.add(scrollPane, BorderLayout.CENTER);
  panel.add(footerPanel(), BorderLayout.PAGE_END);
  return panel;
}
 
Example 13
Source File: ImageSetsPanel.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
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();
    }
 
Example 14
Source File: FilterPanel.java    From GIFKR with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void initializeComponents() {
	filterBox	= FilterLoader.getFilterBox();
	fcp			= getFilter().getSettingsPanel(setP.getRefreshable(), channel);
	
	settingsPane= new JScrollPane(fcp);
	settingsPane.setMinimumSize(new Dimension(fcp.getPreferredSize().width, Math.min(100, fcp.getMinimumSize().height)));
	settingsPane.getViewport().setOpaque(false);
	settingsPane.setBorder(BorderFactory.createEmptyBorder());
	settingsPane.setOpaque(false);
}
 
Example 15
Source File: AdvancedPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void handleTabSwitched(String searchText, List<String> matchedKeywords) {
      final int selectedIndex = tabbedPanel.getSelectedIndex() >= 0 ? tabbedPanel.getSelectedIndex() : -1;
      if (selectedIndex != -1) {
          String category = tabbedPanel.getTitleAt(selectedIndex);
          if (tabbedPanel.getSelectedComponent() instanceof JLabel) {
              JComponent panel = model.getPanel(category);
              if( null == panel.getBorder() ) {
                  panel.setBorder(BorderFactory.createEmptyBorder(11,11,11,11));
              }
              JScrollPane scroll = new JScrollPane(panel);
              scroll.setOpaque(false);
              scroll.getViewport().setOpaque(false);
              scroll.setBorder(BorderFactory.createEmptyBorder());
              scroll.getVerticalScrollBar().setUnitIncrement(Utils.ScrollBarUnitIncrement);
              scroll.getHorizontalScrollBar().setUnitIncrement(Utils.ScrollBarUnitIncrement);
              tabbedPanel.setComponentAt(tabbedPanel.getSelectedIndex(), scroll);
          }
          model.update(category);
          if (searchText != null && matchedKeywords != null) {
OptionsPanelController controller = model.getController(model.getID(category));
if(controller == null) {
    LOGGER.log(Level.WARNING, "No controller found for category: {0}", category);  //NOI18N
} else {
    controller.handleSuccessfulSearch(searchText, matchedKeywords);
}
          }
          firePropertyChange (OptionsPanelController.PROP_HELP_CTX, null, null);        
      }
  }
 
Example 16
Source File: SettingsPage.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
public SettingsPage() {
	setOpaque(false);
	setLayout(null);
	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();

	pageStack = new ArrayList<JPanel>();
}
 
Example 17
Source File: Editor.java    From i18n-editor with MIT License 4 votes vote down vote up
private void setupUI() {
	Color borderColor = Colors.scale(UIManager.getColor("Panel.background"), .8f);
	
	setTitle(TITLE);
	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(new EditorWindowListener());
	
	setIconImages(Lists.newArrayList("512","256","128","64","48","32","24","20","16").stream()
			.map(size -> Images.loadFromClasspath("images/icon-" + size + ".png").getImage())
			.collect(Collectors.toList()));
	
       translationTree = new TranslationTree();
       translationTree.setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
       translationTree.addTreeSelectionListener(new TranslationTreeNodeSelectionListener());
       translationTree.addMouseListener(new TranslationTreeMouseListener());
       
	translationField = new TranslationKeyField();
	translationField.addKeyListener(new TranslationFieldKeyListener());
	translationField.setBorder(BorderFactory.createCompoundBorder(
			BorderFactory.createMatteBorder(1,0,0,1,borderColor),
			((CompoundBorder)translationField.getBorder()).getInsideBorder()));
	
	JScrollPane translationsScrollPane = new JScrollPane(translationTree);
	translationsScrollPane.getViewport().setOpaque(false);
	translationsScrollPane.setOpaque(false);
	translationsScrollPane.setBorder(BorderFactory.createMatteBorder(0,0,0,1,borderColor));
	
	translationsPanel = new JPanel(new BorderLayout());
	translationsPanel.add(translationsScrollPane);
	translationsPanel.add(translationField, BorderLayout.SOUTH);
	
       resourcesPanel = new JScrollablePanel(true, false);
       resourcesPanel.setLayout(new BoxLayout(resourcesPanel, BoxLayout.Y_AXIS));
       resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
       resourcesPanel.setOpaque(false);
       resourcesPanel.addMouseListener(new ResourcesPaneMouseListener());
       
       resourcesScrollPane = new JScrollPane(resourcesPanel);
       resourcesScrollPane.getViewport().setOpaque(false);
       resourcesScrollPane.setOpaque(false);
       resourcesScrollPane.setBorder(null);
       resourcesScrollPane.addMouseListener(new ResourcesPaneMouseListener());
	
	contentPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, translationsPanel, resourcesScrollPane);
	contentPane.setBorder(null);
	contentPane.setDividerSize(10);
	
	// Style the split pane divider if possible
	SplitPaneUI splitPaneUI = contentPane.getUI();
    if (splitPaneUI instanceof BasicSplitPaneUI) {
        BasicSplitPaneDivider divider = ((BasicSplitPaneUI)splitPaneUI).getDivider();
        divider.setBorder(null);
		resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,20));
    }
    
	introText = new JLabel("<html><body style=\"text-align:center; padding:30px;\">" + 
			MessageBundle.get("core.intro.text") + "</body></html>");
	introText.setOpaque(true);
	introText.setFont(introText.getFont().deriveFont(28f));
	introText.setHorizontalTextPosition(JLabel.CENTER);
	introText.setVerticalTextPosition(JLabel.BOTTOM);
	introText.setHorizontalAlignment(JLabel.CENTER);
	introText.setVerticalAlignment(JLabel.CENTER);
	introText.setForeground(getBackground().darker());
	introText.setIcon(Images.loadFromClasspath("images/icon-intro.png"));
	
	Container container = getContentPane();
	container.add(introText);
	
	editorMenu = new EditorMenuBar(this, translationTree);
	setJMenuBar(editorMenu);
}
 
Example 18
Source File: TabbedController.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Replace placeholder with real panel and change help context. */
  private void handleTabSwitched(String searchText, List<String> matchedKeywords) {
      final int selectedIndex = pane.getSelectedIndex();
      if (selectedIndex != -1) {
          String tabTitle = pane.getTitleAt(selectedIndex);
          OptionsPanelController controller = tabTitle2controller.get(tabTitle);
          if (pane.getSelectedComponent() instanceof JLabel) {
              JComponent comp;
              if (controller == null) {
                  AdvancedOption advancedOption = tabTitle2Option.get(tabTitle);
                  if (advancedOption == null) {
                      LOGGER.log(Level.INFO, "AdvancedOption for {0} is not present.", tabTitle);
                      return;
                  } else {
                      controller = advancedOption.create();
                      tabTitle2controller.put(tabTitle, controller);
                      // must be here because many controllers rely on fact that getComponent() is called first than other methods
                      comp = controller.getComponent(masterLookup);
                      // add existing listeners
                      for (PropertyChangeListener pcl : pcs.getPropertyChangeListeners()) {
                          controller.addPropertyChangeListener(pcl);
                      }
                  }
              } else {
                  comp = controller.getComponent(masterLookup);
              }
              if( null == comp.getBorder() ) {
                  comp.setBorder(BorderFactory.createEmptyBorder(11,11,11,11));
              }
              JScrollPane scroll = new JScrollPane(comp);
              scroll.setBorder(BorderFactory.createEmptyBorder());
              scroll.setOpaque(false);
              scroll.getViewport().setOpaque(false);
              scroll.getVerticalScrollBar().setUnitIncrement(Utils.ScrollBarUnitIncrement);
              scroll.getHorizontalScrollBar().setUnitIncrement(Utils.ScrollBarUnitIncrement);
              pane.setComponentAt(selectedIndex, scroll);
              controller.update();
controller.isValid();
          }
   if (searchText != null && matchedKeywords != null) {
controller.handleSuccessfulSearch(searchText, matchedKeywords);
          }
          pcs.firePropertyChange(OptionsPanelController.PROP_HELP_CTX, null, null);
      }
  }
 
Example 19
Source File: PlayerChunkViewer.java    From ChickenChunks with MIT License 4 votes vote down vote up
public TicketInfoDialog(LinkedList<TicketInfo> tickets)
{
    super(PlayerChunkViewer.this);
    setModalityType(ModalityType.DOCUMENT_MODAL);
    this.tickets = tickets;

    infoPane = new JTextPane();
    infoPane.setEditable(false);
    infoPane.setOpaque(false);
    infoPane.setContentType("text/html");
    
    infoScrollPane = new JScrollPane(infoPane);
    infoScrollPane.setOpaque(false);
    add(infoScrollPane);
    
    chunkPane = new JTextPane();
    chunkPane.setEditable(false);
    chunkPane.setOpaque(false);
    chunkPane.setContentType("text/html");
    
    chunkScrollPane = new JScrollPane(chunkPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    add(chunkScrollPane);

    ticketComboBox = new JComboBox<String>();
    for(TicketInfo ticket : tickets)
    {
        String ident = ticket.modId;
        if(ticket.player != null)
            ident += ", " + ticket.player;
        ident += " #" + ticket.ID;
        ticketComboBox.addItem(ident);
    }
    add(ticketComboBox);

    addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowClosing(WindowEvent e)
        {
            dialog = null;
        }
    });

    setLayout(this);
    setSize(getPreferredSize());
    setLocationRelativeTo(null);
    pack();

    dialog = this;

    setVisible(true);
}
 
Example 20
Source File: JScrollPaneFactory.java    From WorldGrower with GNU General Public License v3.0 4 votes vote down vote up
private static void setScrollPaneProperties(JScrollPane scrollPane) {
	scrollPane.setOpaque(false);
	scrollPane.getViewport().setOpaque(false);
}