1 2 Previous Next 23 Replies Latest reply: Sep 26, 2013 4:46 PM by NiXPhoE Go to original post RSS
      • 15. Re: Colors of JFilechooser
        NiXPhoE
        No one can help with this two little bugs, the borders and the triangles?

        Thank you
        • 16. Re: Colors of JFilechooser
          gimbal2
          I'd say the way you try to coax other people into doing the work for you is the main reason why you're being ignored, it has little to do with people not being able to do it.

          You'll have to bite the bullet and keep performing research, reading through endless pieces of documentation and articles, until you figure out a way to do what you want to do. That's how I would do it anyway.
          • 17. Re: Colors of JFilechooser
            NiXPhoE
            Thank you. :)

            I'm not able to find the old thread that contains MyUIJS. That is the code for the triangles. I have the code for them, but I don't know how to combine JSpinner with JFileChoser. And about the borders that are gray I don't now what to search for, becaus I don't know the names of this two fields.
            • 18. Re: Colors of JFilechooser
              NiXPhoE
              I have here the code for the triangles, but I don't know how to integrate this. Who can help please?
              Thank you!
              import java.awt.Color;
              import java.awt.Component;
              import java.awt.FlowLayout;
              import java.awt.Font;
              import java.awt.Graphics;
              import java.awt.GridLayout;
              import java.awt.event.ActionEvent;
              import java.awt.event.ActionListener;
              import java.awt.event.KeyEvent;
              
              import javax.swing.BorderFactory;
              import javax.swing.ButtonModel;
              import javax.swing.ComboBoxEditor;
              import javax.swing.DefaultListCellRenderer;
              import javax.swing.Icon;
              import javax.swing.JButton;
              import javax.swing.JCheckBox;
              import javax.swing.JComboBox;
              import javax.swing.JLabel;
              import javax.swing.JList;
              import javax.swing.JPanel;
              import javax.swing.JScrollPane;
              import javax.swing.ListCellRenderer;
              import javax.swing.UIManager;
              import javax.swing.border.EtchedBorder;
              import javax.swing.border.TitledBorder;
              import javax.swing.plaf.basic.BasicArrowButton;
              import javax.swing.plaf.basic.BasicComboBoxUI;
              import javax.swing.plaf.basic.BasicComboPopup;
              import javax.swing.plaf.basic.ComboPopup;
              
              public class XerxesMain extends JPanel implements ActionListener
              {
                   private static final long serialVersionUID = 1L;
                   public JPanel mainPanel, joystickPanel, rogerPanel, intelPanel, langPanel, staendePanel, swmodePanel, blutPanel, picPanel, resPanel;
                   public JCheckBox joystickCheckbox, rogerCheckbox, intelCheckbox, staendeCheckbox, swmodeCheckbox, blutCheckbox;
                   public JComboBox<String> langlist;
                   public JComboBox<String> reslist;
                   public JLabel langLabel;
                   String[] pics = {"666", "999"};
                   public JComboBox<String> piclist;
                   public JLabel picLabel;
                   public JButton picButton;
                   public TitledBorder joyTitle, rogerTitle, intelTitle, langTitle, staendeTitle, swmodeTitle, blutTitle, picTitle, resTitle;
                   public SetRes setres;
                   public ReadUserCfg readusercfg;
                   public ReadShockCfg readshockcfg;
                   public ReadCamCfg readcamcfg;
                   public ReadInstallCfg readinstallcfg;
              
                   private void setjoystickCheckbox()
                   {
                        if(readusercfg.joystick)
                             joystickCheckbox.setSelected(true);
                        else
                             joystickCheckbox.setSelected(false);
                   }
              
                   public boolean getjoystickCheckbox()
                   {
                        return joystickCheckbox.isSelected();
                   }
              
                   private void setrogerCheckbox()
                   {
                        if(readusercfg.rogerwilco)
                             rogerCheckbox.setSelected(true);
                        else
                             rogerCheckbox.setSelected(false);
                   }
              
                   public boolean getrogerCheckbox()
                   {
                        return rogerCheckbox.isSelected();
                   }
              
                   private void setintelCheckbox()
                   {
                        if(readusercfg.oldintel)
                             intelCheckbox.setSelected(true);
                        else
                             intelCheckbox.setSelected(false);
                   }
              
                   public boolean getintelCheckbox()
                   {
                        return intelCheckbox.isSelected();
                   }
              
                   private void setstaendeCheckbox()
                   {
                        if(readshockcfg.savenameauto)
                             staendeCheckbox.setSelected(true);
                        else
                             staendeCheckbox.setSelected(false);
                   }
                   
                   public boolean getstaendeCheckbox()
                   {
                        return staendeCheckbox.isSelected();
                   }
              
                   private void setswmodeCheckbox()
                   {
                        if(readcamcfg.softhardwaremode)
                             swmodeCheckbox.setSelected(true);
                        else
                             swmodeCheckbox.setSelected(false);
                   }
              
                   public boolean getswmodeCheckbox()
                   {
                        return swmodeCheckbox.isSelected();
                   }
              
                   private void setblutCheckbox()
                   {
                        if(readshockcfg.menschveracht)
                             blutCheckbox.setSelected(true);
                        else
                             blutCheckbox.setSelected(false);
                   }
              
                   public boolean getblutCheckbox()
                   {
                        return blutCheckbox.isSelected();
                   }
              
                   private void setlanglist()
                   {
                        if(readinstallcfg.language.equalsIgnoreCase("en"))
                             langlist.setSelectedIndex(1);
                        else
                             langlist.setSelectedIndex(0);
                   }
              
                   public int getlanglist()
                   {
                        return langlist.getSelectedIndex();
                   }
              
                   private void setreslist()
                   {
                        if(readcamcfg.res.equals("0"))
                             reslist.setSelectedIndex(0);
                        if(readcamcfg.res.equals("1"))
                             reslist.setSelectedIndex(1);
                        if(readcamcfg.res.equals("2"))
                             reslist.setSelectedIndex(2);
                        if(readcamcfg.res.equals("3"))
                             reslist.setSelectedIndex(3);
                        if(readcamcfg.res.equals("4"))
                             reslist.setSelectedIndex(4);
                   }
              
                   public int getreslist()
                   {
                        return reslist.getSelectedIndex();
                   }
                   
                   public void actionPerformed(ActionEvent a) 
                   {
                        if((a.getActionCommand().equalsIgnoreCase("öffnen"))||(a.getActionCommand().equalsIgnoreCase("open")))
                        {
                             
                        }
                   }
              
                   XerxesMain(SetRes setres, ReadUserCfg readusercfg, ReadShockCfg readshockcfg, ReadCamCfg readcamcfg, ReadInstallCfg readinstallcfg)
                   {
                        this.setres = setres;
                        this.readusercfg = readusercfg;
                        this.readshockcfg = readshockcfg;
                        this.readcamcfg = readcamcfg;
                        this.readinstallcfg = readinstallcfg;
                        this.setVisible(true);
                        this.setBackground(Color.black);
                        this.setForeground(Color.green);
                        this.setOpaque(true);
                        mainPanel = new JPanel();
                        
                        mainPanel.setLayout(new GridLayout(3, 3));
                        
                        mainPanel.setBackground(Color.black);
                        mainPanel.setForeground(Color.green);
                        
                        joystickPanel = new JPanel();
                         joyTitle = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPaneJoy"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Arial", Font.PLAIN, 14), 
                        Color.green);
                        joystickPanel.setBorder(joyTitle);
                        joystickPanel.setBackground(Color.black);
                       joystickPanel.setForeground(Color.green);
                        joystickPanel.setOpaque(true);
                        
                        joystickCheckbox = new JCheckBox(setres.getTxt().getString("MainJoy"), new CheckBoxIcon());
                        joystickCheckbox.setSelected(true);
              
                        joystickCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5)); 
              
                        joystickCheckbox.setBackground(Color.black);
                        joystickCheckbox.setForeground(Color.green);
                        joystickCheckbox.setOpaque(true);
                        joystickCheckbox.setMnemonic(KeyEvent.VK_J);
                        //joystickCheckbox.setToolTipText("joystick");
                        setjoystickCheckbox();
                        joystickPanel.add(joystickCheckbox);
                        
                        mainPanel.add(joystickPanel);
              
                        rogerPanel = new JPanel();
                         rogerTitle = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPaneRog"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Serif", Font.PLAIN, 14), 
                        Color.green);
                        rogerPanel.setBorder(rogerTitle);
                        rogerPanel.setBackground(Color.black);
                            rogerPanel.setForeground(Color.green);
                        rogerPanel.setOpaque(true);
                        
                        rogerCheckbox = new JCheckBox(setres.getTxt().getString("MainRog"), new CheckBoxIcon());
                        rogerCheckbox.setSelected(true);
                        rogerCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
                        rogerCheckbox.setBackground(Color.black);
                            rogerCheckbox.setForeground(Color.green);
                        rogerCheckbox.setOpaque(true);
                        
                        setrogerCheckbox();
                        rogerCheckbox.setMnemonic(KeyEvent.VK_S); 
                        rogerPanel.add(rogerCheckbox);
                        
                        mainPanel.add(rogerPanel);
                        
                        intelPanel = new JPanel();
                         intelTitle = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPaneIntel"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Serif", Font.PLAIN, 14), 
                        Color.green);
                        intelPanel.setBorder(intelTitle);
                        intelPanel.setBackground(Color.black);
                            intelPanel.setForeground(Color.green);
                        intelPanel.setOpaque(true);
                        
                        intelCheckbox = new JCheckBox(setres.getTxt().getString("MainIntel"), new CheckBoxIcon());
                        intelCheckbox.setSelected(true);
                        intelCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
                        intelCheckbox.setBackground(Color.black);
                        intelCheckbox.setForeground(Color.green);
                        intelCheckbox.setOpaque(true);
                        
                        setintelCheckbox();
                        intelCheckbox.setMnemonic(KeyEvent.VK_S);
                        intelPanel.add(intelCheckbox);
                        
                        mainPanel.add(intelPanel);
              
                        langPanel = new JPanel();
                        langPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
                        langTitle = BorderFactory.createTitledBorder(
                        BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPaneLanguage"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Serif", Font.PLAIN, 14), Color.green);
                        langLabel = new JLabel(setres.getTxt().getString("MainLabelLanguage"));
                        String[] langs = {setres.getTxt().getString("MainDeuLanguage"), setres.getTxt().getString("MainEngLanguage")};
                        langlist = new JComboBox<String>(langs);
              
                        langlist.setBorder(BorderFactory.createLineBorder(Color.GREEN));
                        langlist.setRenderer(new DefaultListCellRenderer()
                        {
                             private static final long serialVersionUID = 1L;
              
                                  public Component getListCellRendererComponent(JList<?> list,Object value, int index,boolean isSelected,boolean cellHasFocus)
                             {
                                     JLabel lbl2 = (JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
                                     lbl2.setBackground(Color.BLACK);
                                     lbl2.setForeground(Color.GREEN);
                                     return lbl2;
                                   }
                            });
                        langlist.setUI(new MyLangUIComboBox());
                        langlist.setOpaque(true);
                        langlist.setEditable(true);
                        langlist.setForeground(Color.green);
                        langlist.setBackground(Color.black);
                        langlist.getEditor().getEditorComponent().setFocusable(false);
                        mainPanel.add(langPanel);
                        langPanel.setBorder(langTitle);
                        langLabel.setForeground(Color.green);
                        langLabel.setBackground(Color.black);
                        langPanel.add(langLabel);
                        langPanel.add(langlist);
                        langPanel.setBackground(Color.black);
                        langPanel.setForeground(Color.green);
                       setlanglist();
                        staendePanel = new JPanel();
                         staendeTitle = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPaneSave"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Serif", Font.PLAIN, 14), 
                        Color.green);
                        staendePanel.setBorder(staendeTitle);
                        staendePanel.setBackground(Color.black);
                       staendePanel.setForeground(Color.green);
                        staendePanel.setOpaque(true);
                        staendeCheckbox = new JCheckBox(setres.getTxt().getString("MainSave"), new CheckBoxIcon());
                        staendeCheckbox.setSelected(true);
                        staendeCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
                        staendeCheckbox.setBackground(Color.black);
                       staendeCheckbox.setForeground(Color.green);
                        staendeCheckbox.setOpaque(true);
                        setstaendeCheckbox();
                        staendeCheckbox.setMnemonic(KeyEvent.VK_B);
                       staendePanel.add(staendeCheckbox);
                        mainPanel.add(staendePanel);
                        swmodePanel = new JPanel();
                         swmodeTitle = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPaneMode"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Serif", Font.PLAIN, 14), 
                        Color.green);
                        swmodePanel.setBorder(swmodeTitle);
                        swmodePanel.setBackground(Color.black);
                       swmodePanel.setForeground(Color.green);
                        swmodePanel.setOpaque(true);
                        swmodeCheckbox = new JCheckBox(setres.getTxt().getString("MainMode"), new CheckBoxIcon());
                        swmodeCheckbox.setSelected(true);
                        swmodeCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
                        swmodeCheckbox.setBackground(Color.black);
                       swmodeCheckbox.setForeground(Color.green);
                        swmodeCheckbox.setOpaque(true);
                        setswmodeCheckbox();
                        swmodeCheckbox.setMnemonic(KeyEvent.VK_H);
                       swmodePanel.add(swmodeCheckbox);
                       mainPanel.add(swmodePanel);
                       blutPanel = new JPanel();
                         blutTitle = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPaneBlut"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Serif", Font.PLAIN, 14), 
                        Color.green);
                        blutPanel.setBorder(blutTitle);
                        blutPanel.setBackground(Color.black);
                       blutPanel.setForeground(Color.green);
                        blutPanel.setOpaque(true);
                        blutCheckbox = new JCheckBox(setres.getTxt().getString("MainBlut"), new CheckBoxIcon());
                        blutCheckbox.setSelected(true);
                        blutCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
                        blutCheckbox.setBackground(Color.black);
                       blutCheckbox.setForeground(Color.green);
                        blutCheckbox.setOpaque(true);
                        setblutCheckbox();
                        blutCheckbox.setMnemonic(KeyEvent.VK_B);
                       blutPanel.add(blutCheckbox);
                       mainPanel.add(blutPanel);
                        picPanel = new JPanel();
                        picPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
                        picTitle = BorderFactory.createTitledBorder(
                        BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPaneShots"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Serif", Font.PLAIN, 14), Color.green);
                        picPanel.setEnabled(false);
                        picLabel = new JLabel(setres.getTxt().getString("MainLableShots"));
                        piclist = new JComboBox<String>(pics);
                        piclist.setBorder(BorderFactory.createLineBorder(Color.green));
                        piclist.setEditable(true);
                        piclist.setRenderer(new DefaultListCellRenderer()
                        {
                             private static final long serialVersionUID = 1L;
                             public Component getListCellRendererComponent(JList<?> list,Object value, int index,boolean isSelected,boolean cellHasFocus)
                             {
                                     JLabel lbl = (JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
                                     lbl.setBackground(Color.BLACK);
                                     lbl.setForeground(Color.GREEN);
                                     return lbl;
                                   }
                            });
                             piclist.setUI(new MyPicUIComboBox());
                             piclist.setOpaque(true);
                             picButton = new JButton(setres.getTxt().getString("MainButtonShots"));
                             //http://java.sun.com/docs/books/tutorial/uiswing/components/border.html thx to Yannix(forum.java.sun.com)
                             picButton.setBorder(BorderFactory.createCompoundBorder(
                             BorderFactory.createLineBorder(Color.green), 
                             BorderFactory.createEmptyBorder(5,5,5,5)
                        ));
                        picButton.setMnemonic(KeyEvent.VK_V);
                        mainPanel.add(picPanel);
                        picPanel.setBorder(picTitle);
                        picPanel.add(picLabel);
                        picPanel.add(piclist);
                        picPanel.add(picButton);
                        picLabel.setBackground(Color.black);
                        picLabel.setForeground(Color.green);
                        picButton.setBackground(Color.black);
                        picButton.setForeground(Color.green);
                        picPanel.setBackground(Color.black);
                        picPanel.setForeground(Color.green);
                       resPanel = new JPanel();
                        resPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
                       resTitle = BorderFactory.createTitledBorder(
                        BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.green, Color.green),
                        setres.getTxt().getString("MainPanRes"), 
                        TitledBorder.LEADING, 
                        TitledBorder.TOP, 
                        new Font("Serif", Font.PLAIN, 14), Color.green);
                        String[] res = {setres.getTxt().getString("Main640480"), setres.getTxt().getString("Main800600"), setres.getTxt().getString("Main1024768"), setres.getTxt().getString("Main12801024"), setres.getTxt().getString("Main16001200")};
                        reslist = new JComboBox<String>(res);
                        reslist.setBorder(BorderFactory.createLineBorder(Color.green));
                        //reslist.setEditable(true);
                        reslist.setRenderer(new DefaultListCellRenderer()
                        {
                             private static final long serialVersionUID = 1L;
                             public Component getListCellRendererComponent(JList<?> list,Object value, int index,boolean isSelected,boolean cellHasFocus)
                             {
                                     JLabel lres = (JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
                                     lres.setBackground(Color.BLACK);
                                     lres.setForeground(Color.GREEN);
                                     return lres;
                                   }
                            });
                        reslist.setUI(new MyResUIComboBox());
                        reslist.setOpaque(true);
                        reslist.setEditable(true);
                        reslist.getEditor().getEditorComponent().setFocusable(false);
                        //reslist.setMaximumRowCount(reslist.getItemCount());
                        mainPanel.add(resPanel);
                        resPanel.setBorder(resTitle);
                        resPanel.add(reslist);
                        reslist.setBackground(Color.black);
                        reslist.setForeground(Color.green);
                        resPanel.setBackground(Color.black);
                        resPanel.setForeground(Color.green);
                        setreslist();
                        mainPanel.setBackground(Color.black);
                        mainPanel.setForeground(Color.green);
                        this.setOpaque(true);
                        this.add(mainPanel);
                        this.setBorder(BorderFactory.createLineBorder(Color.GREEN));
                   }
              
              //by Michael Dunn
              
              class MyLangUIComboBox extends BasicComboBoxUI
                {
                  protected ComboPopup createPopup()
                  {
                       return new BasicComboPopup(langlist){
                        private static final long serialVersionUID = 1L;
                        protected JScrollPane createScroller()
                      {
                        JScrollPane sp = super.createScroller();
                        sp.setViewportBorder(new javax.swing.border.LineBorder(Color.GREEN));
                        return sp;
                      }
                    };
                  }
                  protected ComboBoxEditor createEditor()
                  {
                    ComboBoxEditor cbe = super.createEditor();
                    cbe.getEditorComponent().setBackground(Color.BLACK);
                    cbe.getEditorComponent().setForeground(Color.GREEN);
                    return cbe;
                  }
                  protected JButton createArrowButton()
                  {
                    return new MyLangBu2BasicArrowButtonCB(BasicArrowButton.SOUTH,
                    UIManager.getColor("ComboBox.buttonBackground"),
                    UIManager.getColor("ComboBox.buttonShadow"),
                    UIManager.getColor("ComboBox.buttonDarkShadow"),
                    UIManager.getColor("ComboBox.buttonHighlight"));
                  }
                }
                class MyLangBu2BasicArrowButtonCB extends BasicArrowButton
                {
                     private static final long serialVersionUID = 1L;
                     public MyLangBu2BasicArrowButtonCB(int direction,Color background,Color shadow,Color darkShadow,Color highlight)
                     {
                     super(direction,background,shadow,darkShadow,highlight);
                     setBackground(Color.BLACK);
                     setBorder(new javax.swing.border.LineBorder(Color.GREEN));
                  }
                  public void paintTriangle(Graphics g,int x,int y,int size,int direction,boolean isEnabled)
                  {
                      Color oldColor = g.getColor();
                      int mid, i, j;
                      j = 0;
                      size = Math.max(size, 2);
                      mid = (size / 2) - 1;
                      g.translate(x, y);
                      g.setColor(Color.GREEN);
                      j = 0;
                      for(i = size-1; i >= 0; i--)
                      {
                          g.drawLine(mid-i, j, mid+i, j);
                          j++;
                      }
                      g.translate(-x, -y);
                      g.setColor(oldColor);
                  }
                }
              
              
                   class MyResUIComboBox extends BasicComboBoxUI
                {
                  protected ComboPopup createPopup()
                  {
                   return new BasicComboPopup(reslist){
                   private static final long serialVersionUID = 1L;
                   protected JScrollPane createScroller()
                      {
                        JScrollPane sp = super.createScroller();
                        sp.setViewportBorder(new javax.swing.border.LineBorder(Color.GREEN));
                        return sp;
                      }
                    };
                  }
                  protected ComboBoxEditor createEditor()
                  {
                    ComboBoxEditor cbe = super.createEditor();
                    cbe.getEditorComponent().setBackground(Color.BLACK);
                    cbe.getEditorComponent().setForeground(Color.GREEN);
                    return cbe;
                  }
                  protected JButton createArrowButton()
                  {
                    return new MyResBu2BasicArrowButtonCB(BasicArrowButton.SOUTH,
                    UIManager.getColor("ComboBox.buttonBackground"),
                    UIManager.getColor("ComboBox.buttonShadow"),
                    UIManager.getColor("ComboBox.buttonDarkShadow"),
                    UIManager.getColor("ComboBox.buttonHighlight"));
                  }
                }
                class MyResBu2BasicArrowButtonCB extends BasicArrowButton
                {
                   private static final long serialVersionUID = 1L;
                   public MyResBu2BasicArrowButtonCB(int direction,Color background,Color shadow,Color darkShadow,Color highlight)
                  {
                      super(direction,background,shadow,darkShadow,highlight);
                      setBackground(Color.BLACK);
                      setBorder(new javax.swing.border.LineBorder(Color.GREEN));
                  }
                  public void paintTriangle(Graphics g,int x,int y,int size,int direction,boolean isEnabled)
                  {
                      Color oldColor = g.getColor();
                      int mid, i, j;
                      j = 0;
                      size = Math.max(size, 2);
                      mid = (size / 2) - 1;
                      g.translate(x, y);
                      g.setColor(Color.GREEN);
                      j = 0;
                      for(i = size-1; i >= 0; i--)
                      {
                          g.drawLine(mid-i, j, mid+i, j);
                          j++;
                      }
                      g.translate(-x, -y);
                      g.setColor(oldColor);
                  }
                }
              
                   class MyPicUIComboBox extends BasicComboBoxUI
                {
                  protected ComboPopup createPopup()
                  {
                       return new BasicComboPopup(piclist){
                       private static final long serialVersionUID = 1L;
                        protected JScrollPane createScroller()
                      {
                        JScrollPane sp = super.createScroller();
                        sp.setViewportBorder(new javax.swing.border.LineBorder(Color.GREEN));
                        return sp;
                      }
                    };
                  }
                  protected ComboBoxEditor createEditor()
                  {
                    ComboBoxEditor cbe = super.createEditor();
                    cbe.getEditorComponent().setBackground(Color.BLACK);
                    cbe.getEditorComponent().setForeground(Color.GREEN);
                    return cbe;
                  }
                  protected JButton createArrowButton()
                  {
                    return new MyBasicArrowButtonCB(BasicArrowButton.SOUTH,
                    // thanx to AL_B
                    UIManager.getColor("ComboBox.buttonBackground"),
                    UIManager.getColor("ComboBox.buttonShadow"),
                    UIManager.getColor("ComboBox.buttonDarkShadow"),
                    UIManager.getColor("ComboBox.buttonHighlight"));
                  }
                }
                class MyBasicArrowButtonCB extends BasicArrowButton
                {
                   private static final long serialVersionUID = 1L;
                   public MyBasicArrowButtonCB(int direction,Color background,Color shadow,Color darkShadow,Color highlight)
                  {
                      super(direction,background,shadow,darkShadow,highlight);
                      setBackground(Color.BLACK);
                      setBorder(new javax.swing.border.LineBorder(Color.GREEN));
                  }
                  public void paintTriangle(Graphics g,int x,int y,int size,int direction,boolean isEnabled)
                  {
                      Color oldColor = g.getColor();
                      int mid, i, j;
                      j = 0;
                      size = Math.max(size, 2);
                      mid = (size / 2) - 1;
                      g.translate(x, y);
                      g.setColor(Color.GREEN);
                      j = 0;
                      for(i = size-1; i >= 0; i--)
                      {
                          g.drawLine(mid-i, j, mid+i, j);
                          j++;
                      }
                      g.translate(-x, -y);
                      g.setColor(oldColor);
                  }
                }
                   
                   
                   public static class ComboBoxRenderer extends JLabel implements ListCellRenderer<Object> 
                   {
                        private static final long serialVersionUID = 1L;
                        public ComboBoxRenderer() 
                           {
                                setOpaque(true);
                           }
                          public Component getListCellRendererComponent(
                             JList<?> list,
                             Object value,
                             int index,
                             boolean isSelected,
                             boolean cellHasFocus) 
                        {
                             list.setForeground(Color.green);
                             list.setBackground(Color.black);
                             return this;
                        }
                      }
                   
                   private static class CheckBoxIcon implements Icon/*, Serializable*/
                  {
                      final static int csize = 13;
                      public void paintIcon(Component c, Graphics g, int x, int y)
                      {
                          JCheckBox cb = (JCheckBox) c;
                          ButtonModel model = cb.getModel();
               
                          // outer bevel
                          if( !cb.isBorderPaintedFlat() )
                          {
                              // Outer top/left
                              g.setColor(Color.green);
                              g.drawLine(x, y, x+11, y);
                              g.drawLine(x, y+1, x, y+11);
               
                              // Outer bottom/right
                              g.setColor(Color.green);
                              g.drawLine(x+12, y, x+12, y+12);
                              g.drawLine(x, y+12, x+11, y+12);
               
                              // Inner top.left
                              g.setColor(Color.green);
                              g.drawLine(x+1, y+1, x+10, y+1);
                              g.drawLine(x+1, y+2, x+1, y+10);
               
                              // Inner bottom/right
                              g.setColor(Color.green);
                              g.drawLine(x+1, y+11, x+11, y+11);
                              g.drawLine(x+11, y+1, x+11, y+10);
               
                              // inside box 
                              if( (model.isPressed() && model.isArmed()) || !model.isEnabled() )
                              {
                                  g.setColor(Color.black);
                              }
                              else
                              {
                                  g.setColor(Color.black);
                              }
                              g.fillRect(x+2, y+2, csize-4, csize-4);
                          }
                          else
                          {
                              g.setColor(Color.green);
                              g.drawRect(x+1, y+1, csize-3, csize-3);
               
                              if( (model.isPressed() && model.isArmed()) || !model.isEnabled() )
                              {
                                  g.setColor(Color.green);
                              }
                              else
                              {
                                  g.setColor(Color.green);
                              }
                              g.fillRect(x+2, y+2, csize-4, csize-4);
                          }
               
                          if( model.isEnabled() )
                          {
                              g.setColor(Color.green);
                          }
                          else
                          {
                              g.setColor(Color.green);
                          }
               
                          // paint check
                          if( model.isSelected() )
                          {
                              g.drawLine(x+9, y+3, x+9, y+3);
                              g.drawLine(x+8, y+4, x+9, y+4);
                              g.drawLine(x+7, y+5, x+9, y+5);
                              g.drawLine(x+6, y+6, x+8, y+6);
                              g.drawLine(x+3, y+7, x+7, y+7);
                              g.drawLine(x+4, y+8, x+6, y+8);
                              g.drawLine(x+5, y+9, x+5, y+9);
                              g.drawLine(x+3, y+5, x+3, y+5);
                              g.drawLine(x+3, y+6, x+4, y+6);
                          }
                      }
               
                      public int getIconWidth()
                      {
                          return(csize);
                      }
               
                      public int getIconHeight()
                      {
                          return(csize);
                      }
                  }
              }
              • 19. Re: Colors of JFilechooser
                NiXPhoE

                gimbal2 thank you. I canT work the way you had described, because I never learned to work with the internet. My three questions are surely secondary to the readers problems!

                I have got the solutions for the triangles and there are only three bugs until we have the perfect layout!

                On the Filechooser the JComboboxes have a fieled with a list and the have a triangle. between this two elements should be a green, thin dividing line I think? Second on the list of the JComboboxes should be also two triangles on the move-buttons to the right side. Thired on the sliderbar's buttons of the file-/directorypane, there should be also green triangles.

                Who can give me a plan, to solve the three little bugs?

                 

                thank you!

                • 20. Re: Colors of JFilechooser
                  NiXPhoE

                  Who can please help with the three bugs?

                  You can see them when you run my program from www.shockcfg.org. the filechooser apears after the ok-dialog, when you run my program with the parameter xerxes.

                   

                  Thank you!!!

                  • 21. Re: Colors of JFilechooser
                    NiXPhoE

                    I'm sorry for that I did a crosspost to a german bord. I have now marked the german thread as done! I won't post there anymore to that thread!

                     

                    Can please anyone give me the missing Code to make the three bugs disapear?

                    thank you.

                    • 22. Re: Colors of JFilechooser
                      NiXPhoE

                      The german thread is closed! Please help me???

                      • 23. Re: Colors of JFilechooser
                        NiXPhoE

                        I could never name me a hacker, I need the right code to insert! I added there in the tool setters and getters. what else should I do to get help?

                        My tool is an ark for java-gui-hacks! Please help me to finish the last undone hack!? I don't have a plan what I should do!?

                        1 2 Previous Next