Example usage for javax.swing JScrollPane setOpaque

List of usage examples for javax.swing JScrollPane setOpaque

Introduction

In this page you can find the example usage for javax.swing JScrollPane setOpaque.

Prototype

@BeanProperty(expert = true, description = "The component's opacity")
public void setOpaque(boolean isOpaque) 

Source Link

Document

If true the component paints every pixel within its bounds.

Usage

From source file:Main.java

public static void makeTransparant(JTable table, JScrollPane scrollPane) {
    table.setOpaque(false);/*  w  w  w. j av  a2  s.  c  o m*/
    ((DefaultTableCellRenderer) table.getDefaultRenderer(Object.class)).setOpaque(false);
    ((DefaultTableCellRenderer) table.getDefaultRenderer(String.class)).setOpaque(false);
    ((JComponent) table.getDefaultRenderer(Boolean.class)).setOpaque(false);

    scrollPane.setOpaque(false);
    scrollPane.getViewport().setOpaque(false);
}

From source file:Main.java

public TestPane() {
    setLayout(new BorderLayout());
    JPanel top = new JPanel(new GridBagLayout());
    top.setOpaque(false);//from   w  w  w.j a  v a  2  s  . c  o m
    top.add(new JLabel("OK"));
    JScrollPane sp = new JScrollPane();
    sp.setOpaque(false);
    sp.getViewport().setOpaque(false);
    sp.setViewportView(top);
    add(sp);
}

From source file:my.jabbr.app.ftpclient.ui.install.ProductLicenseInstallationPanel.java

private void initComponents() {
    try {/* ww w.  j  a  va2 s .  co  m*/
        String licenseStr = FileUtils.readFileToString(new File(ConfigManager.GPL_LICENSE_FILE));
        licenseText = new JTextArea(licenseStr);
        licenseText.setColumns(20);
        licenseText.setRows(15);
        licenseText.setBorder(BorderFactory.createLineBorder(UIAccessories.BORDER_GRAY));
        licenseText.setBackground(UIAccessories.WHITE);
        licenseText.setEditable(false);

        JScrollPane scrollPane = new JScrollPane(licenseText);
        scrollPane.setBorder(null);
        scrollPane.setOpaque(false);
        scrollPane.getViewport().setOpaque(false);
        scrollPane.getViewport().setBorder(null);
        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

        setLayout(new BorderLayout(20, 20));
        add(createTransparentFillerPanel(), BorderLayout.NORTH);
        add(scrollPane, BorderLayout.CENTER);
    } catch (IOException e) {
        e.printStackTrace();
    }

    this.setOpaque(false);
}

From source file:es.emergya.ui.gis.popups.ListaCapas.java

private ListaCapas(CustomMapView mapView, final IMapViewer historyMapViewer) {
    super();// w w  w. ja v a  2  s. c  o m
    setTitle(i18n.getString("window.gpx.titleBar"));
    setLocationRelativeTo(getBasicWindow().getFrame());
    setResizable(false);
    setAlwaysOnTop(true);
    this.mapView = mapView;
    this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setIconImage(getBasicWindow().getFrame().getIconImage());
    JPanel dialogo = new JPanel(new BorderLayout());
    dialogo.setBackground(Color.WHITE);
    dialogo.setBorder(new EmptyBorder(10, 10, 10, 10));

    capasGpx = new JPanel();
    capasGpx.setBackground(Color.WHITE);
    capasGpx.setLayout(new BoxLayout(capasGpx, BoxLayout.Y_AXIS));

    JScrollPane lista = new JScrollPane(capasGpx);
    lista.setOpaque(false);
    lista.setBorder(new TitledBorder(i18n.getString("window.gpx.title")));
    dialogo.add(lista, BorderLayout.CENTER);

    JPanel boton = new JPanel(new FlowLayout());
    boton.setOpaque(false);
    JButton cargar = getCargarGPXButton();
    boton.add(cargar, FlowLayout.LEFT);
    dialogo.add(boton, BorderLayout.SOUTH);

    add(dialogo);
    setPreferredSize(new Dimension(400, 250));
    pack();
    setLocationRelativeTo((Component) mapView);

    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            super.windowClosed(e);
            // historyMapViewer.getGPXButton().setSelected(false);
        }
    });

}

From source file:aurelienribon.gdxsetupui.ui.panels.PreviewPanel.java

public PreviewPanel() {
    initComponents();//ww w  .  ja  v a2s .c  om
    Style.registerCssClasses(headerPanel, ".header");
    Style.registerCssClasses(numberLabel, ".headerNumber");

    JTree tree = new ResultTree();
    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setOpaque(false);
    scrollPane.getViewport().setOpaque(false);
    add(scrollPane, BorderLayout.CENTER);
}

From source file:de.burrotinto.jKabel.dispalyAS.DisplayK.java

@Bean(name = "bearbeitenPanel")
public JPanel getBearbeitenPanel(KabelTypAuswahlAAS kabelTypAuswahlAAS, TrommelAuswahlAAS tommelAAs,
        StreckenAAS streckenAAS, Color background) {

    kabelTypAuswahlAAS.addKabelTypListner(tommelAAs);
    kabelTypAuswahlAAS.addKabelTypListner(streckenAAS);

    tommelAAs.addTrommelListner(streckenAAS);

    JPanel l = new JPanel(new GridLayout(1, 2));
    JPanel all = new JPanel(new GridLayout(1, 2));

    JScrollPane kSP = new JScrollPane(kabelTypAuswahlAAS);
    l.add(kSP);//  w ww.  ja  va2  s.c  om
    l.add(new JScrollPane(tommelAAs));
    all.add(l);
    JScrollPane sc = new JScrollPane(streckenAAS);
    sc.setPreferredSize(new Dimension(740, 740));
    all.add(sc);

    kSP.setOpaque(false);
    sc.setOpaque(false);

    l.setBackground(background);
    kabelTypAuswahlAAS.setBackground(background);
    tommelAAs.setBackground(background);
    streckenAAS.setBackground(background);

    try {
        streckenAAS.setLogo(ImageIO.read(new File(ConfigReader.getInstance().getPath() + "logo.jpg")));
    } catch (IOException e) {
        streckenAAS.setLogo(null);
    }
    all.setBackground(background);
    return all;
}

From source file:com.atlassian.theplugin.idea.jira.PerformIssueActionForm.java

private void setupUI() {
    root = new JPanel();
    root.setOpaque(false);//from   w w w.j av a2  s . c  o  m
    root.setLayout(new BorderLayout(0, 0));
    final JScrollPane scroll = new JScrollPane();
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setOpaque(false);
    scroll.getViewport().setOpaque(false);
    root.add(scroll, BorderLayout.CENTER);
    contentPanel = new ScrollablePanel();
    scroll.setViewportView(contentPanel);
}

From source file:es.emergya.ui.gis.popups.SDSDialog.java

public SDSDialog(Recurso r) {
    super();//  w w  w. j  a  v  a 2  s . c o m
    setAlwaysOnTop(true);
    setResizable(false);
    iconTransparente = LogicConstants.getIcon("48x48_transparente");
    iconEnviando = LogicConstants.getIcon("anim_enviando");
    destino = r;
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            super.windowClosing(e);
            cancel.doClick();
        }
    });

    // setPreferredSize(new Dimension(400, 150));
    setTitle(i18n.getString("window.sds.titleBar") + " " + r.getIdentificador());
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }

    JPanel base = new JPanel();

    base.setBackground(Color.WHITE);
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

    // Icono del titulo
    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));
    final JLabel titleLabel = new JLabel(i18n.getString("window.sds.title"),
            LogicConstants.getIcon("tittleventana_icon_enviarsds"), JLabel.LEFT);

    titleLabel.setFont(LogicConstants.deriveBoldFont(12f));
    title.add(titleLabel);
    title.setOpaque(false);
    base.add(title);

    // Espacio para el mensaje
    sds = new JTextArea(7, 40);
    sds.setLineWrap(true);

    final JScrollPane sdsp = new JScrollPane(sds);

    sdsp.setOpaque(false);
    sdsp.setBorder(new TitledBorder(BorderFactory.createLineBorder(Color.BLACK),
            i18n.getString("Admin.message") + "\t (0/" + maxChars + ")"));
    sds.setDocument(new PlainDocument() {
        @Override
        public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
            if (this.getLength() + str.length() <= maxChars) {
                super.insertString(offs, str, a);
            }
        }
    });
    sds.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            updateChars(e);
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            updateChars(e);
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            updateChars(e);
        }

        private void updateChars(DocumentEvent e) {
            ((TitledBorder) sdsp.getBorder()).setTitle(
                    i18n.getString("Admin.message") + "\t (" + sds.getText().length() + "/" + maxChars + ")");
            sdsp.repaint();
            send.setEnabled(!sds.getText().isEmpty());
            notification.setForeground(Color.WHITE);
            notification.setText("PLACEHOLDER");
        }
    });
    base.add(sdsp);

    // Area para mensajes
    JPanel notificationArea = new JPanel();

    notificationArea.setOpaque(false);
    notification = new JLabel("TEXT");
    notification.setForeground(Color.WHITE);
    notificationArea.add(notification);
    base.add(notificationArea);

    JPanel buttons = new JPanel();

    buttons.setOpaque(false);
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    send = new JButton(i18n.getString("Buttons.send"),
            LogicConstants.getIcon("ventanacontextual_button_enviarsds"));
    send.addActionListener(this);
    send.setEnabled(false);
    buttons.add(send);
    buttons.add(Box.createHorizontalGlue());
    progressIcon = new JLabel(iconTransparente);
    buttons.add(progressIcon);
    buttons.add(Box.createHorizontalGlue());
    cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel"));
    cancel.addActionListener(this);
    buttons.add(cancel);
    base.add(buttons);
    getContentPane().add(base);
    pack();

    int x;
    int y;
    Container myParent;
    try {
        myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getContentPane();
        java.awt.Point topLeft = myParent.getLocationOnScreen();
        Dimension parentSize = myParent.getSize();

        Dimension mySize = getSize();

        if (parentSize.width > mySize.width)
            x = ((parentSize.width - mySize.width) / 2) + topLeft.x;
        else
            x = topLeft.x;

        if (parentSize.height > mySize.height)
            y = ((parentSize.height - mySize.height) / 2) + topLeft.y;
        else
            y = topLeft.y;

        setLocation(x, y);
    } catch (Throwable e1) {
        LOG.error("There is no basic window!", e1);
    }
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent arg0) {
            deleteErrorMessage();
        }

        @Override
        public void windowClosed(WindowEvent arg0) {
            deleteErrorMessage();
        }

        private void deleteErrorMessage() {
            SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() {
                @Override
                protected Object doInBackground() throws Exception {
                    if (bandejaSalida != null) {
                        MessageGenerator.remove(bandejaSalida.getId());
                    }

                    bandejaSalida = null;

                    return null;
                }

                @Override
                protected void done() {
                    super.done();
                    SDSDialog.this.sds.setText("");
                    SDSDialog.this.sds.setEnabled(true);
                    SDSDialog.this.sds.repaint();
                    SDSDialog.this.progressIcon.setIcon(iconTransparente);
                    SDSDialog.this.progressIcon.repaint();
                    SDSDialog.this.notification.setText("");
                    SDSDialog.this.notification.repaint();
                }
            };

            sw.execute();
        }
    });
}

From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java

private JScrollPane addScrollPane(final Dimension dimension, final JList list) {
    JScrollPane scrollleft = new JScrollPane(list);
    scrollleft.setOpaque(false);
    scrollleft.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollleft.getViewport().setOpaque(false);
    scrollleft.setPreferredSize(dimension);
    return scrollleft;
}

From source file:com.jvms.i18neditor.editor.Editor.java

private void setupUI() {
    Color borderColor = Colors.scale(UIManager.getColor("Panel.background"), .8f);

    setTitle(TITLE);//from w ww .jav a 2s .  c  o m
    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 TranslationField();
    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);
}