Пример #1
0
  @Override
  public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {

    Graphics2D graph = (Graphics2D) g.create();
    RoundRectangle2D round = new RoundRectangle2D.Float(x, y, width - 1, height - 1, 30, 30);
    Container parent = c.getParent();

    if (parent != null) {
      graph.setColor(parent.getBackground());
      Area canto = new Area(new Rectangle2D.Float(x, y, width, height));
      canto.subtract(new Area(round));
      graph.fill(canto);
    }

    graph.draw(round);
    graph.dispose();
  }
  protected void doPaintIcon(@NotNull Graphics2D g, @NotNull Icon icon, int offset) {
    final Container parent = getParent();
    Color iconBackgroundColor = null;
    if ((isOpaque() || isIconOpaque()) && !isTransparentIconBackground()) {
      if (parent != null && !myFocusBorderAroundIcon && !UIUtil.isFullRowSelectionLAF()) {
        iconBackgroundColor = parent.getBackground();
      } else {
        iconBackgroundColor = getBackground();
      }
    }

    if (iconBackgroundColor != null) {
      g.setColor(iconBackgroundColor);
      g.fillRect(offset, 0, icon.getIconWidth() + myIpad.left + myIconTextGap, getHeight());
    }

    paintIcon(g, icon, offset + myIpad.left);
  }
Пример #3
0
 @Override
 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
   Graphics2D g2 = (Graphics2D) g.create();
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   int r = 6;
   RoundRectangle2D round = new RoundRectangle2D.Float(x, y, width - 1, height - 1, r, r);
   Container parent = c.getParent();
   if (parent != null) {
     g2.setColor(parent.getBackground());
     Area corner = new Area(new Rectangle2D.Float(x, y, width, height));
     corner.subtract(new Area(round));
     g2.fill(corner);
   }
   if (isVisible) {
     g2.setColor(this.color);
   }
   g2.draw(round);
   g2.dispose();
 }
Пример #4
0
  /** Initializes the components of the dialog */
  private void initComponents() {
    // Initialize basic dialog settings
    setModal(true);

    // setSize(new Dimension(240, 400));
    // setTitle(in_chooser);
    final Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());

    TitledBorder title = BorderFactory.createTitledBorder(null, "Select One");
    avaPane.setBorder(title);

    // Create these labels with " " to force them to layout correctly
    mMessageText = new JLabelPane();
    mMessageText.setBackground(contentPane.getBackground());
    setMessageText(null);

    // Create buttons
    okButton = new JButton(in_ok);
    okButton.setMnemonic(LanguageBundle.getMnemonic("in_mn_ok"));
    cancelButton = new JButton(in_cancel);
    cancelButton.setMnemonic(LanguageBundle.getMnemonic("in_mn_cancel"));

    final ActionListener eventListener =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            if (evt.getSource() == okButton) {
              selectedOK();
            } else if (evt.getSource() == cancelButton) {
              close();
            }
          }
        };

    okButton.addActionListener(eventListener);
    cancelButton.addActionListener(eventListener);

    // Add controls to content pane
    GridBagConstraints c;

    // Add message text
    c = new GridBagConstraints();
    Utility.buildConstraints(c, 0, 0, 3, 1, 0, 0);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 4, 4, 4);
    contentPane.add(mMessageText, c);

    // Add available list
    c = new GridBagConstraints();
    Utility.buildConstraints(c, 0, 1, 3, 1, 1, 1);
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(4, 4, 4, 4);
    JScrollPane avaScrollPane = new JScrollPane();
    avaScrollPane.setViewportView(avaPane);
    contentPane.add(avaScrollPane, c);

    // Add 'OK' and 'Cancel buttons
    JPanel btnPanel = new JPanel();
    btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.X_AXIS));
    btnPanel.add(Box.createHorizontalGlue());
    btnPanel.add(okButton);
    btnPanel.add(Box.createHorizontalStrut(3));
    btnPanel.add(cancelButton);
    c = new GridBagConstraints();
    Utility.buildConstraints(c, 0, 2, 3, 1, 0, 0);
    c.anchor = GridBagConstraints.EAST;
    c.insets = new Insets(0, 4, 4, 4);
    contentPane.add(btnPanel, c);

    okButton.setEnabled(true);
    cancelButton.setEnabled(true);

    Utility.installEscapeCloseOperation(this);
  }
Пример #5
0
  private JPanel getContentPanel(WizardData wzd) {

    JPanel contentPanel1 = new JPanel();

    welcomeTitle = new JLabel();

    contentPanel1.setLayout(new java.awt.BorderLayout());

    welcomeTitle.setFont(new java.awt.Font("MS Sans Serif", Font.BOLD, 11));
    welcomeTitle.setText("Please insert already existing language files!");
    contentPanel1.add(welcomeTitle, BorderLayout.NORTH);

    // ------------------------------------------------------------------------
    Container mainPanel = new JPanel();
    SpringLayout layout = new SpringLayout();
    mainPanel.setLayout(layout);

    JTextArea infoText = new JTextArea();
    infoText.setLineWrap(false);
    infoText.setEditable(false);
    infoText.setFocusable(false);
    infoText.setBackground(mainPanel.getBackground());
    infoText.append(TInfoText.runtime.getText("newwizard", "site2"));

    JDialog parent = null;
    if (wzd.getWizard() != null) {
      parent = wzd.getWizard().getDialog();
    }
    table = new LanguageManagerPanel(TGlobal.projects.getCurrentProject(), parent, true);

    rescanButton.addActionListener(this);
    baseButton.addActionListener(this);

    // Create and add the components.
    mainPanel.add(infoText);
    mainPanel.add(baseLabel);
    mainPanel.add(baseField);
    mainPanel.add(baseButton);
    mainPanel.add(rescanButton);
    mainPanel.add(table);

    // infoText
    layout.putConstraint(SpringLayout.WEST, infoText, 5, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.NORTH, infoText, 5, SpringLayout.NORTH, mainPanel);

    // baseLabel -------------------------------------------------------------
    layout.putConstraint(SpringLayout.WEST, baseLabel, 0, SpringLayout.WEST, infoText);
    layout.putConstraint(SpringLayout.NORTH, baseLabel, 12, SpringLayout.SOUTH, infoText);

    // nameField
    layout.putConstraint(SpringLayout.WEST, baseField, 5, SpringLayout.EAST, baseLabel);
    layout.putConstraint(SpringLayout.NORTH, baseField, 10, SpringLayout.SOUTH, infoText);

    // baseButton
    layout.putConstraint(SpringLayout.WEST, baseButton, 5, SpringLayout.EAST, baseField);
    layout.putConstraint(SpringLayout.NORTH, baseButton, 7, SpringLayout.SOUTH, infoText);

    // rescanButton
    layout.putConstraint(SpringLayout.WEST, rescanButton, 5, SpringLayout.EAST, baseButton);
    layout.putConstraint(SpringLayout.NORTH, rescanButton, 7, SpringLayout.SOUTH, infoText);

    // table
    layout.putConstraint(SpringLayout.WEST, table, 5, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.NORTH, table, 15, SpringLayout.SOUTH, baseField);

    // panel edges ------------------------------------------------------
    layout.putConstraint(SpringLayout.EAST, mainPanel, 5, SpringLayout.EAST, infoText);
    layout.putConstraint(SpringLayout.SOUTH, mainPanel, 5, SpringLayout.SOUTH, table);

    layout.layoutContainer(mainPanel);
    contentPanel1.add(mainPanel, BorderLayout.CENTER);

    return contentPanel1;
  }