Search in sources :

Example 1 with BubbleBorder

use of cc.brino.Brpp.IDEui.BubbleBorder in project Brino by BrinoOficial.

the class FileUtils method abrirFile.

public static void abrirFile(RSyntaxTextArea rSyntaxTextArea) {
    JFileChooser FC = new JFileChooser(BrinoDirectory);
    FC.addChoosableFileFilter(new FileFilter() {

        @Override
        public boolean accept(File file) {
            return file.getName().toUpperCase().contains(".BRPP") || file.isDirectory();
        }

        @Override
        public String getDescription() {
            return "Arquivos de Código Brino";
        }
    });
    for (Component i : FC.getComponents()) {
        try {
            boolean a = true;
            for (Component c : ((JPanel) i).getComponents()) {
                if (c.getClass().toString().equals("class javax.swing.plaf.metal.MetalFileChooserUI$1")) {
                    JComboBox jcom = (JComboBox) c;
                    jcom.setBackground(UIConstants.VERDE);
                    jcom.setForeground(Color.white);
                    jcom.setBorder(new BubbleBorder(UIConstants.VERDE));
                    for (int z = 0; z < jcom.getComponentCount(); z++) {
                        if (jcom.getComponent(z) instanceof JComponent) {
                            ((JComponent) jcom.getComponent(z)).setBorder(UIConstants.BORDAVAZIA);
                        }
                        if (jcom.getComponent(z) instanceof AbstractButton) {
                            ((AbstractButton) jcom.getComponent(z)).setBorderPainted(false);
                        }
                    }
                }
                if (c.getClass() == javax.swing.JLabel.class) {
                    c.setForeground(Color.WHITE);
                }
                if (c.getClass() == javax.swing.JPanel.class) {
                    for (Component d : ((JPanel) c).getComponents()) {
                        if (d.getClass() == javax.swing.JToggleButton.class) {
                            JToggleButton jtg = (JToggleButton) d;
                            if (jtg.getToolTipText().equals("List")) {
                                jtg.setIcon(list);
                                jtg.setSelectedIcon(listFocus);
                                jtg.setBackground(UIConstants.CINZA);
                                jtg.setBorder(UIConstants.BORDAVAZIA);
                                jtg.setRolloverIcon(listFocus);
                            } else {
                                jtg.setIcon(details);
                                jtg.setSelectedIcon(detailsFocus);
                                jtg.setBorder(UIConstants.BORDAVAZIA);
                                jtg.setBackground(UIConstants.CINZA);
                                jtg.setRolloverIcon(detailsFocus);
                            }
                        }
                        if (d.getClass() == javax.swing.JComboBox.class) {
                            JComboBox jcom = (JComboBox) d;
                            jcom.setBackground(UIConstants.VERDE);
                            jcom.setForeground(Color.white);
                            jcom.setBorder(new BubbleBorder(UIConstants.VERDE));
                            for (int z = 0; z < jcom.getComponentCount(); z++) {
                                if (jcom.getComponent(z) instanceof JComponent) {
                                    ((JComponent) jcom.getComponent(z)).setBorder(UIConstants.BORDAVAZIA);
                                }
                                if (jcom.getComponent(z) instanceof AbstractButton) {
                                    ((AbstractButton) jcom.getComponent(z)).setBorderPainted(false);
                                }
                            }
                        }
                        if (d.getClass() != javax.swing.JButton.class && d.getClass() != javax.swing.JComboBox.class)
                            d.setForeground(Color.WHITE);
                        else if (d.getClass() == javax.swing.JButton.class) {
                            // d.setBackground(UIConstants.VERDE);
                            JButton btn = (JButton) d;
                            if (btn.getText() != null) {
                                if (btn.getText().equals("Open")) {
                                    btn.setBorder(new BubbleBorder(UIConstants.VERDE));
                                    btn.setForeground(Color.white);
                                    btn.setText("Abrir");
                                    btn.setBackground(UIConstants.VERDE);
                                }
                                if (btn.getText().equals("Cancel")) {
                                    btn.setBorder(new BubbleBorder(UIConstants.CINZACLARO));
                                    btn.setForeground(Color.white);
                                    btn.setText("Cancelar");
                                    btn.setBackground(UIConstants.CINZACLARO);
                                }
                            }
                            if (btn.getActionCommand().equals("Go Up")) {
                                btn.setIcon(goup);
                                btn.setBorder(UIConstants.BORDAVAZIA);
                                btn.setBackground(UIConstants.CINZA);
                                btn.setRolloverIcon(goupFocus);
                            } else if (btn.getActionCommand().equals("New Folder")) {
                                btn.setIcon(newFolder);
                                btn.setBorder(UIConstants.BORDAVAZIA);
                                btn.setBackground(UIConstants.CINZA);
                                btn.setRolloverIcon(newFolderFocus);
                            } else if (btn.getToolTipText().equals("Home")) {
                                btn.setIcon(homeFolder);
                                btn.setBorder(UIConstants.BORDAVAZIA);
                                btn.setBackground(UIConstants.CINZA);
                                btn.setRolloverIcon(homeFolderFocus);
                            }
                        }
                        if (d.getClass() == javax.swing.JScrollPane.class) {
                            setScroll((JScrollPane) d);
                        }
                    }
                }
            }
        } catch (java.lang.ClassCastException e) {
            e.printStackTrace();
        }
    }
    FC.setAcceptAllFileFilterUsed(false);
    int res = FC.showOpenDialog(null);
    if (res == JFileChooser.APPROVE_OPTION) {
        rSyntaxTextArea.setText(null);
        setDiretorio(FC.getSelectedFile());
        try {
            String f = "";
            Scanner in = new Scanner(new File(getDiretorio().getAbsolutePath()));
            while (in.hasNext()) {
                String line = in.nextLine();
                // Highlight
                f += (line + "\n");
                System.out.println(line);
            }
            rSyntaxTextArea.setText(f);
            in.close();
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        }
    } else
        JOptionPane.showMessageDialog(null, "Voce nao selecionou nenhum diretorio.");
}
Also used : JPanel(javax.swing.JPanel) Scanner(java.util.Scanner) AbstractButton(javax.swing.AbstractButton) JComboBox(javax.swing.JComboBox) JComponent(javax.swing.JComponent) JButton(javax.swing.JButton) FileNotFoundException(java.io.FileNotFoundException) JFileChooser(javax.swing.JFileChooser) JToggleButton(javax.swing.JToggleButton) FileFilter(javax.swing.filechooser.FileFilter) JComponent(javax.swing.JComponent) Component(java.awt.Component) File(java.io.File) BubbleBorder(cc.brino.Brpp.IDEui.BubbleBorder)

Example 2 with BubbleBorder

use of cc.brino.Brpp.IDEui.BubbleBorder in project Brino by BrinoOficial.

the class MenuBar method initUIManager.

public static void initUIManager(MenuBar o) {
    final Font font = new Font(o.getFont().getFamily(), Font.PLAIN, o.getFont().getSize());
    UIManager.put("Menu.font", font);
    UIManager.put("MenuBar.font", font);
    UIManager.put("MenuItem.font", font);
    UIManager.put("RadioButtonMenuItem.font", font);
    UIManager.put("MenuBar.background", Color.BLACK);
    UIManager.put("MenuItem.background", Color.BLACK);
    UIManager.put("RadioButtonMenuItem.background", Color.BLACK);
    UIManager.put("MenuBar.foreground", Color.WHITE);
    UIManager.put("Menu.foreground", Color.WHITE);
    UIManager.put("MenuItem.foreground", Color.WHITE);
    UIManager.put("RadioButtonMenuItem.foreground", Color.WHITE);
    UIManager.put("MenuItem.acceleratorForeground", Color.green);
    UIManager.put("MenuItem.acceleratorSelectionForeground", Color.green);
    UIManager.put("MenuBar.selectionForeground", Color.WHITE);
    UIManager.put("Menu.selectionForeground", Color.WHITE);
    UIManager.put("Menu.textForeground", Color.white);
    UIManager.put("MenuItem.selectionForeground", Color.WHITE);
    UIManager.put("MenuBar.selectionBackground", Color.BLACK);
    UIManager.put("Menu.selectionBackground", Color.BLACK);
    UIManager.put("MenuItem.selectionBackground", UIConstants.CINZA);
    UIManager.put("RadioMenuItem.selectionBackground", UIConstants.CINZA);
    UIManager.put("PopupMenu.border", UIConstants.BORDAVAZIA);
    UIManager.put("PopupMenu.background", Color.BLACK);
    UIManager.put("OptionPane.background", UIConstants.CINZA);
    UIManager.put("OptionPane.messageForeground", Color.WHITE);
    UIManager.put("Panel.background", UIConstants.CINZA);
    UIManager.put("Panel.foreground", Color.WHITE);
    UIManager.put("TextField.background", UIConstants.CINZAESCURO);
    UIManager.put("TextField.foreground", Color.WHITE);
    UIManager.put("TextField.border", new BubbleBorder(UIConstants.CINZAESCURO));
    UIManager.put("textForeground", Color.WHITE);
    UIManager.put("ToolTip.textForeground", Color.WHITE);
    UIManager.put("List.textForeground", Color.WHITE);
    UIManager.put("TextField.foreground", Color.WHITE);
    UIManager.put("TextArea.foreground", Color.WHITE);
    UIManager.put("EditorPane.foreground", Color.WHITE);
    UIManager.put("nimbusBase", UIConstants.CINZAESCURO);
    UIManager.put("FileChooser.listViewBackground", UIConstants.CINZAESCURO);
    UIManager.put("FileChooser.Foreground", Color.WHITE);
    UIManager.put("Button.border", new BubbleBorder(Color.WHITE));
    UIManager.put("ComboBox.borderPaintsFocus", Boolean.TRUE);
    UIManager.put("ComboBox.borderPaints", Boolean.FALSE);
    UIManager.put("ComboBox.editorBorder", UIConstants.BORDAVAZIA);
    UIManager.put("FileView.directoryIcon", folder);
}
Also used : Font(java.awt.Font) BubbleBorder(cc.brino.Brpp.IDEui.BubbleBorder)

Aggregations

BubbleBorder (cc.brino.Brpp.IDEui.BubbleBorder)2 Component (java.awt.Component)1 Font (java.awt.Font)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 Scanner (java.util.Scanner)1 AbstractButton (javax.swing.AbstractButton)1 JButton (javax.swing.JButton)1 JComboBox (javax.swing.JComboBox)1 JComponent (javax.swing.JComponent)1 JFileChooser (javax.swing.JFileChooser)1 JPanel (javax.swing.JPanel)1 JToggleButton (javax.swing.JToggleButton)1 FileFilter (javax.swing.filechooser.FileFilter)1