Esempio n. 1
0
  private JPanel getContainer() {
    layout = new FlowLayout(); // Instanciation du layout
    layout.setAlignment(FlowLayout.CENTER); // On centre les composants

    container = new JPanel(); // On cr�e notre objet
    container.setLayout(layout); // On applique le layout

    textCycle.setEditable(false);
    textCycle.setPreferredSize(new Dimension(600, 200));
    for (int k = 0; k < cycles.size(); k++) {
      textCycle.setText(
          textCycle.getText()
              + "Cycle no"
              + k
              + " :"
              + cycles.get(k).toString()
              + "\n"
              + "\n"); // On lui donne un texte
      container.add(textCycle); // On l'ajoute au container
    }

    btnPath = new JButton(); // Cr�ation du bouton
    btnPath.setPreferredSize(new Dimension(200, 25)); // On lui donne une taille
    btnPath.setText("Show path"); // On lui donne un texte
    btnPath.addActionListener(this); // On ajoute la fen�tre en tant qu'�couteur du bouton
    container.add(btnPath); // On l'ajoute � la fen�tre

    oneState =
        new JComboBox(listOneState); // On cr�e la liste en lui donnant un tableau d'op�rateurs
    oneState.setPreferredSize(new Dimension(140, 25)); // On lui donne une taille
    container.add(oneState); // on l'ajoute � la fen�tre

    twoStates =
        new JComboBox(listTwoStates); // On cr�e la liste en lui donnant un tableau d'op�rateurs
    twoStates.setPreferredSize(new Dimension(140, 25)); // On lui donne une taille
    container.add(twoStates); // on l'ajoute � la fen�tre

    btnCycle = new JButton(); // Cr�ation du bouton
    btnCycle.setPreferredSize(new Dimension(300, 25)); // On lui donne une taille
    btnCycle.setText("Show cycle"); // On lui donne un texte
    btnCycle.addActionListener(this); // On ajoute la fen�tre en tant qu'�couteur du bouton
    container.add(btnCycle); // On l'ajoute � la fen�tre

    cyclesBox =
        new JComboBox(listCycles); // On cr�e la liste en lui donnant un tableau d'op�rateurs
    cyclesBox.setPreferredSize(new Dimension(120, 25)); // On lui donne une taille
    container.add(cyclesBox); // on l'ajoute � la fen�tre

    btnReset = new JButton(); // Cr�ation du bouton
    btnReset.setPreferredSize(new Dimension(400, 25)); // On lui donne une taille
    btnReset.setText("Clear"); // On lui donne un texte
    btnReset.addActionListener(this); // On ajoute la fen�tre en tant qu'�couteur du bouton
    container.add(btnReset); // On l'ajoute � la fen�tre

    return container;
  }
Esempio n. 2
0
  public GlobalControls() {
    setLayout(new GridBagLayout());
    setBorder(new TitledBorder(new EtchedBorder(), "Global Controls"));

    aliasCB = createCheckBox("Anti-Aliasing", true, 0);
    renderCB = createCheckBox("Rendering Quality", false, 1);
    textureCB = createCheckBox("Texture", false, 2);
    compositeCB = createCheckBox("AlphaComposite", false, 3);

    screenCombo = new JComboBox();
    screenCombo.setPreferredSize(new Dimension(120, 18));
    screenCombo.setLightWeightPopupEnabled(true);
    screenCombo.setFont(font);
    for (int i = 0; i < screenNames.length; i++) {
      screenCombo.addItem(screenNames[i]);
    }
    screenCombo.addItemListener(this);
    Java2Demo.addToGridBag(this, screenCombo, 0, 4, 1, 1, 0.0, 0.0);

    toolBarCB = createCheckBox("Tools", false, 5);

    slider = new JSlider(JSlider.HORIZONTAL, 0, 200, 30);
    slider.addChangeListener(this);
    TitledBorder tb = new TitledBorder(new EtchedBorder());
    tb.setTitleFont(font);
    tb.setTitle("Anim delay = 30 ms");
    slider.setBorder(tb);
    slider.setMinimumSize(new Dimension(80, 46));
    Java2Demo.addToGridBag(this, slider, 0, 6, 1, 1, 1.0, 1.0);

    texturechooser = new TextureChooser(0);
    Java2Demo.addToGridBag(this, texturechooser, 0, 7, 1, 1, 1.0, 1.0);
  }
  private void createComponents(JPanel p) {
    String tt = "Any of these:  45.5 -120.2   or   45 30 0 n 120 12 0 w   or   Seattle";

    JComboBox field = new JComboBox();
    field.setOpaque(false);
    field.setEditable(true);
    field.setLightWeightPopupEnabled(false);
    field.setPreferredSize(new Dimension(200, field.getPreferredSize().height));
    field.setToolTipText(tt);

    JLabel label = new JLabel(ImageLibrary.getIcon("gov/nasa/worldwindow/images/safari-24x24.png"));
    //            new
    // ImageIcon(getClass().getResource("gov/nasa/worldwindow/images/safari-24x24.png")));
    label.setOpaque(false);
    label.setToolTipText(tt);

    p.add(label, BorderLayout.WEST);
    p.add(field, BorderLayout.CENTER);

    field.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            performGazeteerAction(actionEvent);
          }
        });
  }
Esempio n. 4
0
 public HeaderPanel(String heading) {
   super();
   this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
   this.setBackground(background);
   JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT);
   Font labelFont = new Font("Dialog", Font.BOLD, 18);
   panelLabel.setFont(labelFont);
   this.add(panelLabel);
   this.add(Box.createHorizontalGlue());
   refresh = new JButton("Refresh");
   refresh.addActionListener(this);
   this.add(refresh);
   this.add(Box.createHorizontalStrut(5));
   root = new JComboBox();
   Dimension d = root.getPreferredSize();
   d.width = 90;
   root.setPreferredSize(d);
   root.setMaximumSize(d);
   File[] roots = directoryPane.getRoots();
   for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath());
   this.add(root);
   root.setSelectedIndex(directoryPane.getCurrentRootIndex());
   root.addActionListener(this);
   this.add(Box.createHorizontalStrut(17));
 }
 public ReferencePropertyWidget(boolean containedByListReferenceGUI) {
   this.containedByListReferenceGUI = containedByListReferenceGUI;
   // get Options
   m_comboBox = new JComboBox();
   m_comboBox.setEditable(false);
   m_comboBox.setPreferredSize(new Dimension(300, 20));
   // m_comboBox.setMinimumSize(new Dimension(260, 20));
   m_comboBox.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));
   KeyStroke controlT = KeyStroke.getKeyStroke("control SPACE");
   getTextField().getInputMap().put(controlT, controlT);
   getTextField().getActionMap().put(controlT, new CodeCompleteAction());
   ToolTipManager.sharedInstance().registerComponent(m_comboBox);
 }
Esempio n. 6
0
 // 构造器,用于初始化的登录对话框
 public LoginFrame(LanTalk parent, String msg) {
   super(parent, "输入名字后登录", true);
   this.chatFrame = parent;
   setLayout(new GridLayout(5, 1));
   JPanel jp = new JPanel();
   tip = new JLabel(msg);
   tip.setFont(new Font("Serif", Font.BOLD, 16));
   jp.add(tip);
   add(jp);
   add(getPanel("用户名", userField));
   iconList.setPreferredSize(new Dimension(224, 20));
   add(getPanel("图    标", iconList));
   JPanel bp = new JPanel();
   loginBn.addActionListener(new MyActionListener(this));
   bp.add(loginBn);
   add(bp);
   pack();
   setVisible(true);
 }
  @Inject
  public ProblemSelectionPanel(qcevolutionbackend be) {
    this.setLayout(new BorderLayout());
    backend = be;
    Set<String> probs = backend.getProbmanager().getAvailableProblems();
    String[] options = new String[probs.size() + 1];
    options[0] = "Please Select Problem";
    int index = 1;
    Iterator<String> iter = probs.iterator();
    while (iter.hasNext()) {
      options[index++] = iter.next();
    }
    selection_model = new DefaultComboBoxModel(options);

    description = new JTextPane();
    description.setEditable(false);
    description_scroller = new JScrollPane(description);
    description_scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    description_scroller.setPreferredSize(new Dimension(250, 155));
    description_scroller.setMinimumSize(new Dimension(10, 10));

    if (backend.getCurrentse() != null) {
      String key = backend.getQproblem().getName();
      selection_model.setSelectedItem(key);
      description.setText(backend.getProbmanager().getSearchEngineDesc(key));
    }

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    selection = new JComboBox(selection_model);
    selection.addActionListener(this);
    selection.setPreferredSize(new Dimension((int) (screenSize.width * MainPanel.right_perc), 30));
    selection.setMaximumSize(new Dimension((int) (screenSize.width * MainPanel.right_perc), 30));

    be.addObserver(this);
    be.getProbmanager().addObserver(this);
    if (null != backend.getCurrentse()) {
      backend.getCurrentse().addObserver(this);
    }

    this.add(selection, BorderLayout.NORTH);
    this.add(description_scroller, BorderLayout.CENTER);
  }
  private void setKierunekComboBox() {
    Vector<String> kierunki = new Vector<String>();
    if (linia != null) {
      for (Trasa t : linia.getTrasy()) {
        kierunki.add(t.getKierunek());
      }
    }
    kierunkiComboBox = new JComboBox(kierunki);
    TitledBorder tr = BorderFactory.createTitledBorder("Kierunek");
    kierunkiComboBox.setBorder(tr);
    kierunkiComboBox.setPreferredSize(new Dimension(300, 50));
    kierunkiComboBox.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            String kierunekString = (String) kierunkiComboBox.getSelectedItem();
            trasa = linia.getTrasa(kierunekString);
            updatePrzystankiScrollPane();
            updateRozkladScrollPane();
          }
        });
  }
  /** @param owner */
  WordArtCustomDialog(Frame owner) {
    super(owner, "Add Text", true);
    this.setResizable(false);
    this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String[] fontList = ge.getAvailableFontFamilyNames();
    fontCombo = new JComboBox<String>(fontList);

    italic = new JCheckBox("Italic");
    bold = new JCheckBox("Bold");

    sizeCombo = new JComboBox<String>(SZ);
    ((JLabel) sizeCombo.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER);
    sizeCombo.setSelectedIndex(4);
    sizeCombo.setPreferredSize(new Dimension(45, 21)); // tweek size

    example = new JTextField(" Example ");
    example.setHorizontalAlignment(SwingConstants.CENTER);
    example.setFont(new Font("sanserif", Font.PLAIN, 28));
    example.setEditable(false);

    ok = new JButton("Apply");
    cancel = new JButton("Cancel");
    ok.setPreferredSize(cancel.getPreferredSize());

    foreground = new JButton("Color");

    fontCombo.addActionListener(this);
    italic.addItemListener(this);
    bold.addItemListener(this);
    sizeCombo.addActionListener(this);
    ok.addActionListener(this);
    cancel.addActionListener(this);
    foreground.addActionListener(this);
    // custom dialog set up
    JPanel p0 = new JPanel();
    p0.add(fontCombo);
    p0.setBorder(new TitledBorder(new EtchedBorder(), "Font family"));

    JPanel p1a = new JPanel();
    p1a.add(italic);
    p1a.add(bold);
    p1a.setBorder(new TitledBorder(new EtchedBorder(), "Font style"));

    JPanel p1b = new JPanel();
    p1b.add(sizeCombo);
    p1b.add(new JLabel("pt."));
    p1b.setBorder(new TitledBorder(new EtchedBorder(), "Font size"));

    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.X_AXIS));
    p1.add(p1a);
    p1.add(p1b);
    p1.setAlignmentX(Component.CENTER_ALIGNMENT);

    JPanel p2 = new JPanel(); // use FlowLayout
    p2.add(foreground);
    p2.setBorder(new TitledBorder(new EtchedBorder(), "Message color"));
    p2.setAlignmentX(Component.CENTER_ALIGNMENT);

    JPanel p3 = new JPanel();
    p3.setLayout(new BoxLayout(p3, BoxLayout.Y_AXIS));
    p3.add(example);
    p3.setPreferredSize(new Dimension(250, 60));
    p3.setMaximumSize(new Dimension(250, 60));
    p3.setAlignmentX(Component.CENTER_ALIGNMENT);

    JPanel p4 = new JPanel();
    p4.add(ok);
    p4.add(cancel);
    p4.setAlignmentX(Component.CENTER_ALIGNMENT);

    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(p0);
    p.add(Box.createRigidArea(new Dimension(0, 10)));
    p.add(p1);
    p.add(Box.createRigidArea(new Dimension(0, 10)));
    p.add(p2);
    p.add(Box.createRigidArea(new Dimension(0, 10)));
    p.add(p3);
    p.add(Box.createRigidArea(new Dimension(0, 10)));
    p.add(p4);
    p.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    // tweek sizes of panels to make the dialog look nice

    Dimension d1 = p3.getPreferredSize();
    Dimension d2 = p1.getPreferredSize();
    p1.setPreferredSize(new Dimension(d1.width, d2.height));
    p1.setMaximumSize(new Dimension(d1.width, d2.height));
    d2 = p2.getPreferredSize();
    p2.setPreferredSize(new Dimension(d1.width, d2.height));
    p2.setMaximumSize(new Dimension(d1.width, d2.height));

    this.setContentPane(p);
    this.pack();
  }
Esempio n. 10
0
  public CPLayersPalette(CPCommonController controller) {
    super(controller);

    title = "Layers";

    // Widgets creation

    Image icons = controller.loadImage("smallicons.png");

    addButton = new CPIconButton(icons, 16, 16, 0, 1);
    addButton.addController(this);
    addButton.setCPActionCommand(CPCommandId.AddLayer);

    removeButton = new CPIconButton(icons, 16, 16, 1, 1);
    removeButton.addController(this);
    removeButton.setCPActionCommand(CPCommandId.RemoveLayer);

    alphaSlider = new CPAlphaSlider();

    blendCombo = new JComboBox<String>(modeNames);
    blendCombo.addActionListener(this);

    lw = new CPLayerWidget();
    renameField = new CPRenameField();
    lw.add(renameField);
    scrollPane = new JScrollPane(lw);

    cbSampleAllLayers = new JCheckBox("Sample All Layers");
    cbSampleAllLayers.setSelected(controller.artwork.isSampleAllLayers());
    cbSampleAllLayers.addItemListener(this);

    cbLockAlpha = new JCheckBox("Lock Alpha");
    cbLockAlpha.setSelected(controller.artwork.isLockAlpha());
    cbLockAlpha.addItemListener(this);

    // Layout

    // Add/Remove Layer
    Box hb = Box.createHorizontalBox();
    hb.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    hb.add(addButton);
    hb.add(Box.createRigidArea(new Dimension(5, 0)));
    hb.add(removeButton);
    hb.add(Box.createHorizontalGlue());

    // blend mode
    blendCombo.setPreferredSize(new Dimension(100, 16));

    Box hb2 = Box.createHorizontalBox();
    hb2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    hb2.add(blendCombo);
    hb2.add(Box.createHorizontalGlue());

    // layer opacity
    alphaSlider.setPreferredSize(new Dimension(100, 16));
    alphaSlider.setMaximumSize(new Dimension(100, 16));

    Box hb3 = Box.createHorizontalBox();
    hb3.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    hb3.add(alphaSlider);
    hb3.add(Box.createRigidArea(new Dimension(0, 16)));
    hb3.add(Box.createHorizontalGlue());

    Box hb4 = Box.createHorizontalBox();
    hb4.add(cbSampleAllLayers);
    hb4.add(Box.createHorizontalGlue());

    Box hb5 = Box.createHorizontalBox();
    hb5.add(cbLockAlpha);
    hb5.add(Box.createHorizontalGlue());

    Box vb = Box.createVerticalBox();
    vb.add(hb2);
    vb.add(hb3);
    vb.add(hb4);
    vb.add(hb5);

    setLayout(new BorderLayout());
    add(scrollPane, BorderLayout.CENTER);
    add(vb, BorderLayout.PAGE_START);
    add(hb, BorderLayout.PAGE_END);

    // Set initial values
    CPArtwork artwork = controller.getArtwork();
    alphaSlider.setValue(artwork.getActiveLayer().getAlpha());

    // add listeners

    addListener();
    // validate();
    // pack();
  }
  public EducAssignmentPanel() {
    super("‘ормирование учебных поручений");
    List<Image> icons = new Vector<Image>();
    icons.add(new ImageIcon("images/уп.png").getImage());
    setIconImages(icons);
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    this.setPreferredSize(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT));
    this.setResizable(false);
    Dimension dim_screen = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(
        (int) dim_screen.getWidth() / 2 - DEFAULT_WIDTH / 2,
        (int) dim_screen.getHeight() / 2 - DEFAULT_HEIGHT / 2);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JPanel content_top = BoxLayoutUtils.createHorizontalPanel();

    // ----------------------------------------------------------
    JPanel semester = BoxLayoutUtils.createHorizontalPanel();
    semester.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JLabel lab_semester = new JLabel("¬ид семестра:");
    semester_combo = new JComboBox<String>();
    semester_combo.setBackground(Color.white);
    semester_combo.addItem("летний");
    semester_combo.addItem("зимний");
    lab_semester.setPreferredSize(new Dimension(100, 27));
    lab_semester.setMaximumSize(lab_semester.getPreferredSize());
    lab_semester.setMinimumSize(lab_semester.getPreferredSize());
    semester_combo.setPreferredSize(new Dimension(100, 27));
    semester_combo.setMaximumSize(semester_combo.getPreferredSize());
    semester_combo.setMinimumSize(semester_combo.getPreferredSize());
    semester.add(lab_semester);
    semester.add(semester_combo);

    JPanel bevel_semester = BoxLayoutUtils.createHorizontalPanel();
    bevel_semester.setBorder(BorderFactory.createLoweredBevelBorder());

    JPanel out_semester = BoxLayoutUtils.createHorizontalPanel();
    out_semester.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    bevel_semester.add(semester);
    out_semester.add(bevel_semester);
    // ----------------------------------------------------------

    JPanel cath = BoxLayoutUtils.createVerticalPanel();
    cath.setBackground(Color.white);
    semester.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    CurriculumTransaction tr = new CurriculumTransaction();
    ArrayList<String> cath_names = tr.getCathedras();
    checks = new ArrayList<JCheckBox>();
    this.checks.add(new JCheckBox("выбрать все..."));
    for (String name : cath_names) checks.add(new JCheckBox(name));
    for (JCheckBox cur_check : checks) {
      cath.add(Box.createHorizontalStrut(5));
      cath.add(cur_check);
      cur_check.setBackground(Color.white);
    }
    checks
        .get(0)
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                JCheckBox check = (JCheckBox) e.getSource();
                if (check.isSelected()) {
                  for (JCheckBox cur : checks) cur.setSelected(true);
                } else for (JCheckBox cur : checks) cur.setSelected(false);
              }
            });
    cath.add(Box.createGlue());

    JPanel bevel_cath = BoxLayoutUtils.createHorizontalPanel();
    bevel_cath.setBorder(BorderFactory.createLoweredBevelBorder());

    JPanel out_cath = BoxLayoutUtils.createHorizontalPanel();
    out_cath.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));

    bevel_cath.add(new JScrollPane(cath));
    out_cath.add(bevel_cath);
    // ----------------------------------------------------------
    JPanel right = BoxLayoutUtils.createVerticalPanel();
    right.add(out_semester);
    right.add(out_cath);

    content_top.add(right);
    chooser = new JFileChooser();
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    content_top.add(chooser);
    // ----------------------------------------------------------
    JPanel content_create = BoxLayoutUtils.createHorizontalPanel();
    content_create.add(Box.createHorizontalGlue());
    create = new JButton("—формировать поручени¤");
    create.setPreferredSize(new Dimension(200, 27));
    create.setMinimumSize(create.getPreferredSize());
    create.setMaximumSize(create.getPreferredSize());
    cancel = new JButton("ќтмена");
    cancel.setPreferredSize(new Dimension(100, 27));
    cancel.setMinimumSize(cancel.getPreferredSize());
    cancel.setMaximumSize(cancel.getPreferredSize());
    content_create.add(create);
    content_create.add(Box.createHorizontalStrut(5));
    content_create.add(cancel);
    content_create.add(Box.createHorizontalStrut(4));

    JPanel create_empty = BoxLayoutUtils.createHorizontalPanel();
    create_empty.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JPanel content_bottom = BoxLayoutUtils.createHorizontalPanel();
    content_bottom.setBorder(BorderFactory.createEtchedBorder());
    create_empty.add(content_create);
    content_bottom.add(create_empty);

    JPanel content = BoxLayoutUtils.createVerticalPanel();
    content.add(content_top);
    content.add(content_bottom);

    create.addActionListener(this);
    cancel.addActionListener(this);
    setContentPane(content);
    setVisible(true);
  }
Esempio n. 12
0
  /**
   * Конструктор
   *
   * @param mediator Посредник родитьельского окна
   */
  public ButtonToolBar(final IGuiMediator mediator) {
    this.mediator = mediator;

    try {
      locale = ((WBDrawing) mediator).getLocalizer();
    } catch (Exception e) {
      logger.debug(e.getMessage(), e);
    }

    mouseMenu = new JPopupMenu();
    imagePanel = new JPanel();
    imagePanel.setLayout(new GridLayout(4, 2));
    mouseMenu.add(imagePanel);
    imagePanel.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            System.out.println("Focus Gained");
          }

          public void focusLost(FocusEvent e) {
            mouseMenu.setVisible(false);
            System.out.println("Focus Lost");
          }
        });

    URL url = ClassLoader.getSystemResource("img/open.gif");
    Icon iconOpen = new ImageIcon(url);
    JButton btnOpen = new JButton(iconOpen);
    btnOpen.setToolTipText(locale.getString("btntoolbar.open"));
    url = ClassLoader.getSystemResource("img/save.gif");
    Icon iconSave = new ImageIcon(url);
    JButton btnSave = new JButton(iconSave);
    btnSave.setToolTipText(locale.getString("btntoolbar.save"));
    url = ClassLoader.getSystemResource("img/undo.gif");
    Icon iconUndo = new ImageIcon(url);
    btnUndo = new JButton(iconUndo);
    btnUndo.setToolTipText(locale.getString("btntoolbar.undo"));
    url = ClassLoader.getSystemResource("img/redo.gif");
    Icon iconRedo = new ImageIcon(url);
    btnRedo = new JButton(iconRedo);
    btnRedo.setToolTipText(locale.getString("btntoolbar.redo"));
    url = ClassLoader.getSystemResource("img/draw.gif");
    Icon iconDraw = new ImageIcon(url);
    btnDraw = new JToggleButton(iconDraw, true);
    btnDraw.setToolTipText(locale.getString("btntoolbar.draw"));
    url = ClassLoader.getSystemResource("img/pen.gif");
    Icon iconPen = new ImageIcon(url);
    btnPen = new JToggleButton(iconPen);
    btnPen.setToolTipText(locale.getString("btntoolbar.pen"));
    url = ClassLoader.getSystemResource("img/calibrate.gif");
    Icon iconCalibrate = new ImageIcon(url);
    btnCalibrate = new JToggleButton(iconCalibrate);
    btnCalibrate.setToolTipText(locale.getString("btntoolbar.calibration"));
    url = ClassLoader.getSystemResource("img/gridMove.gif");
    Icon iconGridMove = new ImageIcon(url);

    JToggleButton btnGrigMove = new JToggleButton(iconGridMove);
    url = ClassLoader.getSystemResource("img/hand.gif");
    Icon iconHand = new ImageIcon(url);

    JToggleButton btnHand = new JToggleButton(iconHand);
    btnHand.setToolTipText(locale.getString("btntoolbar.hand"));

    url = ClassLoader.getSystemResource("img/selTool.gif");
    Icon iconSelTool = new ImageIcon(url);
    JToggleButton btnSelTool = new JToggleButton(iconSelTool);

    url = ClassLoader.getSystemResource("img/spline.gif");
    Icon iconQuadTool = new ImageIcon(url);
    btnSpline = new JToggleButton(iconQuadTool);
    btnSpline.setToolTipText(locale.getString("btntoolbar.spline"));

    btnTools = new JToggleButton("T");

    btnTextTool = new JToggleButton("A");

    url = ClassLoader.getSystemResource("img/ruler.gif");
    Icon iconRulerTool = new ImageIcon(url);
    btnRulerTool = new JToggleButton(iconRulerTool);

    url = ClassLoader.getSystemResource("img/sendFile.gif");
    Icon iconSendFile = new ImageIcon(url);
    JToggleButton btnFileTransmit = new JToggleButton(iconSendFile);
    btnFileTransmit.setToolTipText(locale.getString("btntoolbar.fileTransmit"));
    url = ClassLoader.getSystemResource("img/nodesEdit.gif");
    Icon iconNodesEdit = new ImageIcon(url);

    JToggleButton btnNodesEdit = new JToggleButton(iconNodesEdit);
    btnNodesEdit.setToolTipText(locale.getString("btntoolbar.nodeEdit"));

    JButton btnTest = new JButton(locale.getString("btntoolbar.button.Test"));
    btnTest.setEnabled(false);
    url = ClassLoader.getSystemResource("img/send.gif");
    Icon iconSend = new ImageIcon(url);
    JButton btnSendArq = new JButton(iconSend);
    btnSendArq.setToolTipText(locale.getString("btntoolbar.send"));
    url = ClassLoader.getSystemResource("img/clear.gif");
    Icon iconClear = new ImageIcon(url);
    JButton btnClearTab = new JButton(iconClear);
    btnClearTab.setToolTipText(locale.getString("btntoolbar.clear"));

    JButton btnRequestModel = new JButton(locale.getString("btntoolbar.button.RequestModel"));
    btnRequestModel.setEnabled(false);

    JComboBox cmbTools = new JComboBox();
    cmbTools.addItem("Thick Line");

    cmbTools.addItemListener(
        new ItemListener() {

          public void itemStateChanged(ItemEvent e) {
            boolean selected = btnTools.getModel().isSelected();
            if (selected) {
              mode = getToolsMode();
              guiChanged();
            }
          }
        });

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(btnDraw);
    buttonGroup.add(btnPen);
    buttonGroup.add(btnCalibrate);
    buttonGroup.add(btnGrigMove);
    buttonGroup.add(btnHand);
    buttonGroup.add(btnSelTool);
    buttonGroup.add(btnSpline);
    buttonGroup.add(btnTextTool);
    buttonGroup.add(btnRulerTool);
    buttonGroup.add(btnNodesEdit);
    // buttonGroup.add( btnTools );

    btnDraw.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_DRAWING;
            }
            guiChanged();
          }
        });

    btnPen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_PEN;
            }
            guiChanged();
          }
        });

    btnCalibrate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_CALIBRATING;
            }
            guiChanged();
          }
        });

    btnGrigMove.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_GRID_MOVING;
            }
            guiChanged();
          }
        });

    btnHand.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_HAND_MAP;
            }
            guiChanged();
          }
        });

    btnSelTool.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_SELECT_TOOL;
            }
            guiChanged();
          }
        });

    btnSpline.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_QUAD_TOOL;
            }
            guiChanged();
          }
        });

    btnTextTool.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_TEXT_TOOL;
            }
            guiChanged();
          }
        });

    btnRulerTool.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_RULER_TOOL;
            }
            guiChanged();
          }
        });

    btnNodesEdit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_NODES_EDIT;
            }
            guiChanged();
          }
        });

    btnTools.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mode = getToolsMode();
            guiChanged();
          }
        });

    btnOpen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnOpenPressed();
          }
        });

    btnSave.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnSavePressed();
          }
        });

    btnUndo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnUndoPressed();
          }
        });

    btnRedo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnRedoPressed();
          }
        });

    btnTest.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnTestPressed();
          }
        });

    btnSendArq.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnSendModelPressed();
          }
        });

    btnSendArq.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnSendArqModelPressed();
          }
        });

    btnClearTab.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnClearTabPressed();
          }
        });

    btnRequestModel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnFileTransmitPressed();
          }
        });

    btnFileTransmit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnFileTransmitPressed();
          }
        });

    add(btnOpen);
    add(btnSave);
    //        add( btnUndo );
    //        add( btnRedo );
    addSeparator();
    // add(lblMode);

    actionButton = new JToggleButton(btnDraw.getIcon());
    actionButton.setToolTipText(btnDraw.getToolTipText());
    actionButton.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            mouseMenu.show(e.getComponent(), e.getX(), e.getY());
          }
        });
    addButton(btnDraw);
    addButton(btnPen);
    addButton(btnCalibrate);
    // add( btnGrigMove );
    addButton(btnHand);
    // add(btnSelTool);
    addButton(btnSpline);
    addButton(btnNodesEdit);
    // add( btnTextTool );
    addButton(btnRulerTool);
    // addSeparator();
    // add(cmbTools);
    add(actionButton);

    cmbScale = new JComboBox();
    cmbScale.setEditable(true);
    cmbScale.addItem("1:1000");
    cmbScale.addItem("1:2000");
    cmbScale.addItem("1:5000");
    cmbScale.addItem("1:10000");
    cmbScale.addItem("1:25000");
    cmbScale.addItem("1:50000");
    cmbScale.addItem("1:100000");
    cmbScale.setSelectedIndex(3);
    cmbScale.setToolTipText(locale.getString("btntoolbar.scale"));
    cmbScale.setPreferredSize(cmbScale.getMinimumSize());
    cmbScale.setMaximumSize(cmbScale.getMinimumSize());

    cmbScale.addItemListener(new ZoomListener());
    addSeparator();

    chbVisibleGrid = new JCheckBox();
    chbVisibleGrid.setSelected(true);
    chbVisibleGrid.setToolTipText(locale.getString("btntoolbar.grid"));
    // addSeparator();
    chbVisibleGrid.addItemListener(
        new ItemListener() {

          public void itemStateChanged(ItemEvent e) {
            guiChanged();
          }
        });
    add(btnFileTransmit);
    add(btnSendArq);
    add(btnClearTab);
    add(chbVisibleGrid);
    add(cmbScale);
    // addSeparator();
    // add( lblControl );
    // add( btnSend );
    // add( btnRequestModel );
    // add( btnTest );
  }
  public void objektAnlegen() {

    frame = new JFrame("anlegen");

    JPanel anlegenPanel = new JPanel();

    GridBagLayout gbl = new GridBagLayout();

    anlegenPanel.setLayout(gbl);

    GridBagConstraints constraints = new GridBagConstraints();

    listelabel = new JLabel("<html>Was möchten sie neu anlegen?<br/>Bitte wählen:");
    listelabel.setFont(new Font("Arial", 18, 18));

    constraints.insets = new Insets(16, 16, 16, 16);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 0;
    anlegenPanel.add(listelabel, constraints);

    // Vector erstellen und Jcombobox mit diesen Daten füllen
    Vector<String> anlegenvector = new Vector<String>();
    anlegenvector.add("Zitat anlegen");
    anlegenvector.add("Person anlegen");
    anlegenvector.add("Sammelwerk anlegen");
    anlegenvector.add("Werk anlegen");
    anlegenvector.add("Verlag anlegen");

    boxanlegen = new JComboBox(anlegenvector);
    Dimension groesseObjekt = new Dimension(300, 25);
    boxanlegen.setPreferredSize(groesseObjekt);
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 1;
    constraints.fill = GridBagConstraints.NONE;
    anlegenPanel.add(boxanlegen, constraints);

    anlegen = new JButton("anlegen");
    constraints.insets = new Insets(56, 16, 0, 0);
    constraints.gridwidth = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    anlegenPanel.add(anlegen, constraints);
    anlegen.addActionListener(new anlegenListener());

    abbrechen = new JButton("abbrechen");
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    anlegenPanel.add(abbrechen, constraints);
    abbrechen.addActionListener(new abbrechenListener());

    frame.getContentPane().add(anlegenPanel);

    // die Größe des frames wird festgelegt
    frame.setSize(400, 300);

    frame.setResizable(false);
    // der frame wird sichtbar gemacht
    frame.setVisible(true);
  }
  /**
   * Class constructor. It creates the information panel at the bottom of the main window
   *
   * @param c Geometric canvas
   */
  public InfoPanelBottom(Canvas2D c, Properties propi) {
    canvas = c;
    prop = propi;

    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new BorderLayout());

    tamFrame = new JLabel(prop.getProperty("FrameSize") + ":     ");
    pos = new JLabel(prop.getProperty("Coords") + ":         ");
    value = new JLabel(prop.getProperty("Value") + ":          ");

    JPanel auxPanel1 = new JPanel();
    JPanel auxPanel2 = new JPanel();
    JPanel auxPanel21 = new JPanel();
    JPanel auxPanel22 = new JPanel();
    JPanel auxPanel23 = new JPanel();

    auxPanel1.setLayout(new BoxLayout(auxPanel1, BoxLayout.Y_AXIS));

    auxPanel1.add(tamFrame);
    auxPanel1.add(pos);
    auxPanel1.add(value);

    auxPanel21.setLayout(new BorderLayout());
    auxPanel22.setLayout(new BorderLayout());
    auxPanel23.setLayout(new BorderLayout());
    auxPanel2.setLayout(new BoxLayout(auxPanel2, BoxLayout.Y_AXIS));

    JLabel labFrame = new JLabel(prop.getProperty("Frame") + ":  ");
    auxPanel21.add(labFrame, BorderLayout.WEST);

    frameSel = new JComboBox();
    frameSel.addItem("[ " + prop.getProperty("Nosequence") + " ]");
    frameSel.setPreferredSize(new Dimension(250, 20));
    auxPanel21.add(frameSel, BorderLayout.EAST);

    JLabel labBanda = new JLabel(prop.getProperty("Band") + ":   ");
    auxPanel22.add(labBanda, BorderLayout.WEST);

    bandSel = new JComboBox();
    bandSel.addItem("[ " + prop.getProperty("Nosequence") + " ]");
    bandSel.setPreferredSize(new Dimension(250, 20));
    auxPanel22.add(bandSel, BorderLayout.EAST);

    auxPanel2.add(auxPanel21);
    auxPanel2.add(auxPanel22);

    JLabel auxpbar = new JLabel(prop.getProperty("Progress") + ":");
    auxPanel23.add(auxpbar, BorderLayout.WEST);
    //		 The progress bar has a minimum value 0 and a maximum of 100
    pBar = new JProgressBar(0, 100);
    pBar.setPreferredSize(new Dimension(250, 15));
    pBar.setStringPainted(true);
    auxPanel23.add(pBar, BorderLayout.EAST);
    auxPanel2.add(auxPanel23);

    add(auxPanel1, BorderLayout.WEST);
    add(auxPanel2, BorderLayout.EAST);

    bandSel.addActionListener(this);
    frameSel.addActionListener(this);
  }
Esempio n. 15
0
  public void initializeMainView(
      final SuperAdapter superAdapter,
      Container contentPane,
      Dimension bigPanelDim,
      Dimension panelDim) {
    contentPane.setLayout(new BorderLayout());

    final JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    contentPane.add(mainPanel, BorderLayout.CENTER);
    mainPanel.setBackground(Color.white);

    final JPanel toolbarPanel = new JPanel();
    toolbarPanel.setBorder(null);

    toolbarPanel.setLayout(new GridBagLayout());
    mainPanel.add(toolbarPanel, BorderLayout.NORTH);

    JPanel bigPanel = new JPanel();
    bigPanel.setLayout(new BorderLayout());
    bigPanel.setBackground(Color.white);

    bigPanel.setPreferredSize(new Dimension(bigPanelDim));
    bigPanel.setMaximumSize(new Dimension(bigPanelDim));
    bigPanel.setMinimumSize(new Dimension(bigPanelDim));

    JPanel bottomPanel = new JPanel();
    bottomPanel.setBackground(Color.white);

    JMenuBar menuBar = null;
    try {
      menuBar = superAdapter.createMenuBar();
    } catch (Exception e) {
      e.printStackTrace();
    }
    assert menuBar != null;
    contentPane.add(menuBar, BorderLayout.NORTH);

    GridBagConstraints toolbarConstraints = new GridBagConstraints();
    toolbarConstraints.anchor = GridBagConstraints.LINE_START;
    toolbarConstraints.fill = GridBagConstraints.HORIZONTAL;
    toolbarConstraints.gridx = 0;
    toolbarConstraints.gridy = 0;
    toolbarConstraints.weightx = 0.1;

    // --- Chromosome panel ---
    JPanel chrSelectionPanel = new JPanel();
    toolbarPanel.add(chrSelectionPanel, toolbarConstraints);

    chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder());

    chrSelectionPanel.setLayout(new BorderLayout());

    JPanel chrLabelPanel = new JPanel();
    JLabel chrLabel = new JLabel("Chromosomes");
    chrLabel.setHorizontalAlignment(SwingConstants.CENTER);
    chrLabelPanel.setBackground(HiCGlobals.backgroundColor);
    chrLabelPanel.setLayout(new BorderLayout());
    chrLabelPanel.add(chrLabel, BorderLayout.CENTER);
    chrSelectionPanel.add(chrLabelPanel, BorderLayout.PAGE_START);

    JPanel chrButtonPanel = new JPanel();
    chrButtonPanel.setBackground(new Color(238, 238, 238));
    chrButtonPanel.setLayout(new BoxLayout(chrButtonPanel, BoxLayout.X_AXIS));

    // ---- chrBox1 ----
    chrBox1 = new JComboBox<Chromosome>();
    chrBox1.setModel(
        new DefaultComboBoxModel<Chromosome>(new Chromosome[] {new Chromosome(0, "All", 0)}));
    chrBox1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            chrBox1ActionPerformed(e);
          }
        });
    chrBox1.setPreferredSize(new Dimension(95, 70));
    chrButtonPanel.add(chrBox1);

    // ---- chrBox2 ----
    chrBox2 = new JComboBox<Chromosome>();
    chrBox2.setModel(
        new DefaultComboBoxModel<Chromosome>(new Chromosome[] {new Chromosome(0, "All", 0)}));
    chrBox2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            chrBox2ActionPerformed(e);
          }
        });
    chrBox2.setPreferredSize(new Dimension(95, 70));
    chrButtonPanel.add(chrBox2);

    // ---- refreshButton ----
    refreshButton = new JideButton();
    refreshButton.setIcon(
        new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif")));
    refreshButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            superAdapter.safeRefreshButtonActionPerformed();
          }
        });
    refreshButton.setPreferredSize(new Dimension(24, 24));
    chrButtonPanel.add(refreshButton);

    chrBox1.setEnabled(false);
    chrBox2.setEnabled(false);
    refreshButton.setEnabled(false);
    chrSelectionPanel.add(chrButtonPanel, BorderLayout.CENTER);

    chrSelectionPanel.setMinimumSize(new Dimension(200, 70));
    chrSelectionPanel.setPreferredSize(new Dimension(210, 70));

    // ======== Display Option Panel ========
    JPanel displayOptionPanel = new JPanel();
    displayOptionPanel.setBackground(new Color(238, 238, 238));
    displayOptionPanel.setBorder(LineBorder.createGrayLineBorder());
    displayOptionPanel.setLayout(new BorderLayout());
    JPanel displayOptionLabelPanel = new JPanel();
    displayOptionLabelPanel.setBackground(HiCGlobals.backgroundColor);
    displayOptionLabelPanel.setLayout(new BorderLayout());

    JLabel displayOptionLabel = new JLabel("Show");
    displayOptionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    displayOptionLabelPanel.add(displayOptionLabel, BorderLayout.CENTER);
    displayOptionPanel.add(displayOptionLabelPanel, BorderLayout.PAGE_START);
    JPanel displayOptionButtonPanel = new JPanel();
    displayOptionButtonPanel.setBorder(new EmptyBorder(0, 10, 0, 10));
    displayOptionButtonPanel.setLayout(new GridLayout(1, 0, 20, 0));
    displayOptionComboBox = new JComboBox<MatrixType>();
    displayOptionComboBox.setModel(
        new DefaultComboBoxModel<MatrixType>(new MatrixType[] {MatrixType.OBSERVED}));
    displayOptionComboBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            superAdapter.safeDisplayOptionComboBoxActionPerformed();
            normalizationComboBox.setEnabled(!isWholeGenome());
          }
        });
    displayOptionButtonPanel.add(displayOptionComboBox);
    displayOptionPanel.add(displayOptionButtonPanel, BorderLayout.CENTER);
    displayOptionPanel.setMinimumSize(new Dimension(140, 70));
    displayOptionPanel.setPreferredSize(new Dimension(140, 70));
    displayOptionPanel.setMaximumSize(new Dimension(140, 70));

    toolbarConstraints.gridx = 1;
    toolbarConstraints.weightx = 0.1;
    toolbarPanel.add(displayOptionPanel, toolbarConstraints);
    displayOptionComboBox.setEnabled(false);

    // ======== Normalization Panel ========
    JPanel normalizationPanel = new JPanel();
    normalizationPanel.setBackground(new Color(238, 238, 238));
    normalizationPanel.setBorder(LineBorder.createGrayLineBorder());
    normalizationPanel.setLayout(new BorderLayout());

    JPanel normalizationLabelPanel = new JPanel();
    normalizationLabelPanel.setBackground(HiCGlobals.backgroundColor);
    normalizationLabelPanel.setLayout(new BorderLayout());

    JLabel normalizationLabel = new JLabel("Normalization");
    normalizationLabel.setHorizontalAlignment(SwingConstants.CENTER);
    normalizationLabelPanel.add(normalizationLabel, BorderLayout.CENTER);
    normalizationPanel.add(normalizationLabelPanel, BorderLayout.PAGE_START);

    JPanel normalizationButtonPanel = new JPanel();
    normalizationButtonPanel.setBorder(new EmptyBorder(0, 10, 0, 10));
    normalizationButtonPanel.setLayout(new GridLayout(1, 0, 20, 0));
    normalizationComboBox = new JComboBox<String>();
    normalizationComboBox.setModel(
        new DefaultComboBoxModel<String>(new String[] {NormalizationType.NONE.getLabel()}));
    normalizationComboBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            superAdapter.safeNormalizationComboBoxActionPerformed(e);
          }
        });
    normalizationButtonPanel.add(normalizationComboBox);
    normalizationPanel.add(normalizationButtonPanel, BorderLayout.CENTER);
    normalizationPanel.setPreferredSize(new Dimension(180, 70));
    normalizationPanel.setMinimumSize(new Dimension(140, 70));

    toolbarConstraints.gridx = 2;
    toolbarConstraints.weightx = 0.1;
    toolbarPanel.add(normalizationPanel, toolbarConstraints);
    normalizationComboBox.setEnabled(false);

    // ======== Resolution Panel ========
    hiCPanel = new JPanel();
    hiCPanel.setBackground(Color.white);
    hiCPanel.setLayout(new HiCLayout());
    bigPanel.add(hiCPanel, BorderLayout.CENTER);

    JPanel wrapGapPanel = new JPanel();
    wrapGapPanel.setBackground(Color.white);
    wrapGapPanel.setMaximumSize(new Dimension(5, 5));
    wrapGapPanel.setMinimumSize(new Dimension(5, 5));
    wrapGapPanel.setPreferredSize(new Dimension(5, 5));
    wrapGapPanel.setBorder(LineBorder.createBlackLineBorder());
    bigPanel.add(wrapGapPanel, BorderLayout.EAST);

    // splitPanel.insertPane(hiCPanel, 0);
    // splitPanel.setBackground(Color.white);

    // ---- rulerPanel2 ----
    JPanel topPanel = new JPanel();
    topPanel.setBackground(Color.green);
    topPanel.setLayout(new BorderLayout());
    hiCPanel.add(topPanel, BorderLayout.NORTH);
    trackLabelPanel = new TrackLabelPanel(superAdapter.getHiC());
    trackLabelPanel.setBackground(Color.white);
    hiCPanel.add(trackLabelPanel, HiCLayout.NORTH_WEST);

    trackPanelX = new TrackPanel(superAdapter, superAdapter.getHiC(), TrackPanel.Orientation.X);
    trackPanelX.setMaximumSize(new Dimension(4000, 50));
    trackPanelX.setPreferredSize(new Dimension(1, 50));
    trackPanelX.setMinimumSize(new Dimension(1, 50));
    trackPanelX.setVisible(false);
    topPanel.add(trackPanelX, BorderLayout.NORTH);

    rulerPanelX = new HiCRulerPanel(superAdapter.getHiC());
    rulerPanelX.setMaximumSize(new Dimension(4000, 50));
    rulerPanelX.setMinimumSize(new Dimension(1, 50));
    rulerPanelX.setPreferredSize(new Dimension(1, 50));
    rulerPanelX.setBorder(null);
    topPanel.add(rulerPanelX, BorderLayout.SOUTH);

    // ---- rulerPanel1 ----
    JPanel leftPanel = new JPanel();
    leftPanel.setBackground(Color.white);
    leftPanel.setLayout(new BorderLayout());
    hiCPanel.add(leftPanel, BorderLayout.WEST);

    trackPanelY = new TrackPanel(superAdapter, superAdapter.getHiC(), TrackPanel.Orientation.Y);
    trackPanelY.setMaximumSize(new Dimension(50, 4000));
    trackPanelY.setPreferredSize(new Dimension(50, 1));
    trackPanelY.setMinimumSize(new Dimension(50, 1));
    trackPanelY.setVisible(false);
    leftPanel.add(trackPanelY, BorderLayout.WEST);

    rulerPanelY = new HiCRulerPanel(superAdapter.getHiC());
    rulerPanelY.setMaximumSize(new Dimension(50, 4000));
    rulerPanelY.setPreferredSize(new Dimension(50, 800));
    rulerPanelY.setBorder(null);
    rulerPanelY.setMinimumSize(new Dimension(50, 1));
    leftPanel.add(rulerPanelY, BorderLayout.EAST);

    // ---- heatmapPanel ----
    // Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
    // int panelSize = screenDimension.height - 210;

    int panelWidth = (int) panelDim.getWidth();
    int panelHeight = (int) panelDim.getHeight();
    System.err.println("Window W: " + panelWidth + " H" + panelHeight);

    JPanel wrapHeatmapPanel = new JPanel(new BorderLayout());
    wrapHeatmapPanel.setMaximumSize(new Dimension(panelDim));
    wrapHeatmapPanel.setMinimumSize(new Dimension(panelDim));
    wrapHeatmapPanel.setPreferredSize(new Dimension(panelDim));
    wrapHeatmapPanel.setBackground(Color.BLUE);
    wrapHeatmapPanel.setVisible(true);

    heatmapPanel = new HeatmapPanel(superAdapter);
    heatmapPanel.setMaximumSize(new Dimension(panelWidth - 5, panelHeight - 5));
    heatmapPanel.setMinimumSize(new Dimension(panelWidth - 5, panelHeight - 5));
    heatmapPanel.setPreferredSize(new Dimension(panelWidth - 5, panelHeight - 5));
    heatmapPanel.setBackground(Color.white);

    wrapHeatmapPanel.add(heatmapPanel, BorderLayout.CENTER);

    // hiCPanel.setMaximumSize(new Dimension(panelWidth, panelHeight));
    // hiCPanel.setMinimumSize(new Dimension(panelWidth, panelHeight));
    // hiCPanel.setPreferredSize(new Dimension(panelWidth, panelHeight));

    hiCPanel.add(wrapHeatmapPanel, BorderLayout.CENTER);

    // ======== Resolution Slider Panel ========

    // Resolution  panel
    resolutionSlider = new ResolutionControl(superAdapter);
    resolutionSlider.setPreferredSize(new Dimension(200, 70));
    resolutionSlider.setMinimumSize(new Dimension(150, 70));

    toolbarConstraints.gridx = 3;
    toolbarConstraints.weightx = 0.1;
    toolbarPanel.add(resolutionSlider, toolbarConstraints);

    // ======== Color Range Panel ========
    colorRangePanel = new JColorRangePanel(superAdapter, heatmapPanel, preDefMapColor);

    toolbarConstraints.gridx = 4;
    toolbarConstraints.weightx = 0.5;
    toolbarPanel.add(colorRangePanel, toolbarConstraints);

    goPanel = new GoToPanel(superAdapter);
    toolbarConstraints.gridx = 5;
    toolbarConstraints.weightx = 0.25;
    toolbarPanel.add(goPanel, toolbarConstraints);
    // not sure this is working
    // toolbarPanel.setPreferredSize(new Dimension(panelHeight,100));
    toolbarPanel.setEnabled(false);

    // ======== Right side panel ========

    JPanel rightSidePanel = new JPanel(new BorderLayout()); // (new BorderLayout());
    rightSidePanel.setBackground(Color.white);
    rightSidePanel.setPreferredSize(new Dimension(210, 1000));
    rightSidePanel.setMaximumSize(new Dimension(10000, 10000));

    // ======== Bird's view mini map ========

    JPanel thumbPanel = new JPanel();
    thumbPanel.setLayout(new BorderLayout());

    // ---- thumbnailPanel ----
    thumbnailPanel = new ThumbnailPanel(superAdapter);
    thumbnailPanel.setBackground(Color.white);
    thumbnailPanel.setMaximumSize(new Dimension(210, 210));
    thumbnailPanel.setMinimumSize(new Dimension(210, 210));
    thumbnailPanel.setPreferredSize(new Dimension(210, 210));

    //        JPanel gapPanel = new JPanel();
    //        gapPanel.setMaximumSize(new Dimension(1, 1));
    //        rightSidePanel.add(gapPanel,BorderLayout.WEST);
    thumbPanel.add(thumbnailPanel, BorderLayout.CENTER);
    thumbPanel.setBackground(Color.white);
    rightSidePanel.add(thumbPanel, BorderLayout.NORTH);

    // ========= mouse hover text ======
    JPanel tooltipPanel = new JPanel(new BorderLayout());
    tooltipPanel.setBackground(Color.white);
    tooltipPanel.setPreferredSize(new Dimension(210, 490));
    mouseHoverTextPanel = new JEditorPane();
    mouseHoverTextPanel.setEditable(false);
    mouseHoverTextPanel.setContentType("text/html");
    mouseHoverTextPanel.setFont(new Font("sans-serif", 0, 20));
    mouseHoverTextPanel.setBackground(Color.white);
    mouseHoverTextPanel.setBorder(null);
    int mouseTextY = rightSidePanel.getBounds().y + rightSidePanel.getBounds().height;

    // *Dimension prefSize = new Dimension(210, 490);
    Dimension prefSize = new Dimension(210, 390);
    mouseHoverTextPanel.setPreferredSize(prefSize);

    JScrollPane tooltipScroller = new JScrollPane(mouseHoverTextPanel);
    tooltipScroller.setBackground(Color.white);
    tooltipScroller.setBorder(null);

    tooltipPanel.setPreferredSize(new Dimension(210, 500));
    tooltipPanel.add(tooltipScroller);
    tooltipPanel.setBounds(new Rectangle(new Point(0, mouseTextY), prefSize));
    tooltipPanel.setBackground(Color.white);
    tooltipPanel.setBorder(null);

    rightSidePanel.add(tooltipPanel, BorderLayout.CENTER);

    // compute preferred size
    Dimension preferredSize = new Dimension();
    for (int i = 0; i < rightSidePanel.getComponentCount(); i++) {
      Rectangle bounds = rightSidePanel.getComponent(i).getBounds();
      preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
      preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
    }
    Insets insets = rightSidePanel.getInsets();
    preferredSize.width += insets.right + 20;
    preferredSize.height += insets.bottom;
    rightSidePanel.setMinimumSize(preferredSize);
    rightSidePanel.setPreferredSize(preferredSize);
    mainPanel.add(bigPanel, BorderLayout.CENTER);
    mainPanel.add(rightSidePanel, BorderLayout.EAST);
  }
Esempio n. 16
0
 void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(10, 10, 5, 5);
   panel1.setLayout(borderLayout1);
   jPanel1.setLayout(borderLayout2);
   jScrollPane1.getViewport().setBackground(Color.white);
   jPanel2.setLayout(gridBagLayout1);
   jLabel1.setText("Profile Name : ");
   nameTextField.setMinimumSize(new Dimension(4, 18));
   nameTextField.setPreferredSize(new Dimension(63, 18));
   jLabel2.setText("Profile Type : ");
   openButton.setMaximumSize(new Dimension(73, 24));
   openButton.setMinimumSize(new Dimension(73, 24));
   openButton.setPreferredSize(new Dimension(73, 24));
   openButton.setText("Open");
   openButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           openButton_actionPerformed(e);
         }
       });
   cancelButton.setMaximumSize(new Dimension(73, 24));
   cancelButton.setMinimumSize(new Dimension(73, 24));
   cancelButton.setPreferredSize(new Dimension(73, 24));
   cancelButton.setMargin(new Insets(0, 5, 0, 5));
   cancelButton.setText("Cancel");
   cancelButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           cancelButton_actionPerformed(e);
         }
       });
   profileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   profileList.addMouseListener(
       new java.awt.event.MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           profileList_mouseClicked(e);
         }
       });
   jPanel2.setBorder(border1);
   typeComboBox.setMaximumSize(new Dimension(32767, 18));
   typeComboBox.setMinimumSize(new Dimension(122, 18));
   typeComboBox.setPreferredSize(new Dimension(176, 18));
   getContentPane().add(panel1);
   panel1.add(jPanel1, BorderLayout.CENTER);
   jPanel1.add(jScrollPane1, BorderLayout.CENTER);
   panel1.add(jPanel2, BorderLayout.SOUTH);
   jPanel2.add(
       jLabel1,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 0, 7, 0),
           0,
           0));
   jPanel2.add(
       nameTextField,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 11, 7, 0),
           0,
           0));
   jPanel2.add(
       jLabel2,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 0, 17, 0),
           0,
           0));
   jScrollPane1.getViewport().add(profileList, null);
   jPanel2.add(
       openButton,
       new GridBagConstraints(
           3,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 11, 2, 10),
           0,
           0));
   jPanel2.add(
       cancelButton,
       new GridBagConstraints(
           3,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 11, 9, 10),
           0,
           0));
   jPanel2.add(
       typeComboBox,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 11, 17, 0),
           0,
           0));
 }
Esempio n. 17
0
 /**
  * Creates and lays out components in the container. See the comments below for an organizational
  * overview by panel.
  */
 private void initComponents(Container c) {
   // +=c=====================================================+
   // ++=gcPanel==============================================+
   // ++                    [gcSelection]                     +
   // ++=capsPanel============================================+
   // +++=imageCapsPanel======================================+
   // +++ [imageAccelerated]                                  +
   // +++ [imageTrueVolatile]                                 +
   // +++=bufferCapsPanel=====================================+
   // ++++=bufferAccessCapsPanel==============================+
   // +++++=flippingPanel=====================================+
   // +++++ [flipping]                                        +
   // +++++=fsPanel===========================================+
   // +++++ [indentPanel][fullScreen]                         +
   // +++++=mbPanel===========================================+
   // +++++ [indentPanel][multiBuffer]                        +
   // ++++=buffersPanel=======================================+
   // +++++=fbPanel===============+=bbPanel===================+
   // +++++                       +                           +
   // +++++ [fbAccelerated]       + [bbAccelerated]           +
   // +++++                       +                           +
   // +++++ [fbTrueVolatile]      + [bbTrueVolatile]          +
   // +++++                       +                           +
   // +=======================================================+
   c.setLayout(new BorderLayout());
   // Graphics Config
   JPanel gcPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
   c.add(gcPanel, BorderLayout.NORTH);
   gcSelection.setPreferredSize(new Dimension(400, 30));
   gcPanel.add(gcSelection);
   // Capabilities
   JPanel capsPanel = new JPanel(new BorderLayout());
   c.add(capsPanel, BorderLayout.CENTER);
   // Image Capabilities
   JPanel imageCapsPanel = new JPanel(new GridLayout(2, 1));
   capsPanel.add(imageCapsPanel, BorderLayout.NORTH);
   imageCapsPanel.setBorder(BorderFactory.createTitledBorder("Image Capabilities"));
   imageAccelerated.setEnabled(false);
   imageCapsPanel.add(imageAccelerated);
   imageTrueVolatile.setEnabled(false);
   imageCapsPanel.add(imageTrueVolatile);
   // Buffer Capabilities
   JPanel bufferCapsPanel = new JPanel(new BorderLayout());
   capsPanel.add(bufferCapsPanel, BorderLayout.CENTER);
   bufferCapsPanel.setBorder(BorderFactory.createTitledBorder("Buffer Capabilities"));
   // Buffer Access
   JPanel bufferAccessCapsPanel = new JPanel(new GridLayout(3, 1));
   bufferAccessCapsPanel.setPreferredSize(new Dimension(300, 88));
   bufferCapsPanel.add(bufferAccessCapsPanel, BorderLayout.NORTH);
   // Flipping
   JPanel flippingPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
   bufferAccessCapsPanel.add(flippingPanel);
   flippingPanel.add(flipping);
   flipping.setEnabled(false);
   flippingPanel.add(flippingMethod);
   // Full-screen
   JPanel fsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
   bufferAccessCapsPanel.add(fsPanel);
   JPanel indentPanel = new JPanel();
   indentPanel.setPreferredSize(new Dimension(30, 30));
   fsPanel.add(indentPanel);
   fsPanel.add(fullScreen);
   fullScreen.setEnabled(false);
   // Multi-buffering
   JPanel mbPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
   bufferAccessCapsPanel.add(mbPanel);
   indentPanel = new JPanel();
   indentPanel.setPreferredSize(new Dimension(30, 30));
   mbPanel.add(indentPanel);
   mbPanel.add(multiBuffer);
   multiBuffer.setEnabled(false);
   // Front and Back Buffer Capabilities
   JPanel buffersPanel = new JPanel(new GridLayout(1, 2));
   bufferCapsPanel.add(buffersPanel, BorderLayout.CENTER);
   // Front Buffer
   JPanel fbPanel = new JPanel(new GridLayout(2, 1));
   fbPanel.setBorder(BorderFactory.createTitledBorder("Front Buffer"));
   buffersPanel.add(fbPanel);
   fbPanel.add(fbAccelerated);
   fbAccelerated.setEnabled(false);
   fbPanel.add(fbTrueVolatile);
   fbTrueVolatile.setEnabled(false);
   // Back Buffer
   JPanel bbPanel = new JPanel(new GridLayout(2, 1));
   bbPanel.setPreferredSize(new Dimension(250, 80));
   bbPanel.setBorder(BorderFactory.createTitledBorder("Back and Intermediate Buffers"));
   buffersPanel.add(bbPanel);
   bbPanel.add(bbAccelerated);
   bbAccelerated.setEnabled(false);
   bbPanel.add(bbTrueVolatile);
   bbTrueVolatile.setEnabled(false);
 }
  public DiameterCutOptionsTargetPanel() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Lungime:", 100));
    JFormattedTextField length = GUIFactory.createNumberInput(4100L, 0L, 1000000L, 80);
    panel.add(length);
    JComboBox<String> mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Diametru 1:", 100));
    JFormattedTextField smallRadius = GUIFactory.createNumberInput(200L, 0L, 1000000L, 80);
    panel.add(smallRadius);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Diametru 2:", 100));
    JFormattedTextField bigRadius = GUIFactory.createNumberInput(600L, 0L, 1000000L, 80);
    panel.add(bigRadius);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    label2 = GUIFactory.createLabel("Produse:", 100);
    panel.add(label2);
    products = ProductDAO.getProducts();
    JPanel productsPanel = new JPanel();
    productsPanel.setLayout(new BoxLayout(productsPanel, BoxLayout.Y_AXIS));
    for (Product product : products) {
      JPanel row = new JPanel(new FlowLayout(FlowLayout.LEFT));
      JCheckBox chk = new JCheckBox();
      row.add(chk);
      selection.add(chk);
      chk.setName("length" + (long) product.getLength());
      row.add(new JLabel(product.getName()));
      productsPanel.add(row);
    }
    JScrollPane scrollPane = new JScrollPane(productsPanel);
    scrollPane.setPreferredSize(new Dimension(productsPanel.getPreferredSize().width + 20, 215));
    panel.add(scrollPane);
    add(panel);

    JPanel filtru = new JPanel(new FlowLayout(FlowLayout.LEADING));
    filtru.add(filtru2m);
    filtru.add(filtru3m);
    filtru.add(filtru4m);
    filtru2m.setActionCommand("FILTRU2");
    filtru3m.setActionCommand("FILTRU3");
    filtru4m.setActionCommand("FILTRU4");
    filtru2m.addActionListener(this);
    filtru3m.addActionListener(this);
    filtru4m.addActionListener(this);
    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JLabel label1 = GUIFactory.createLabel("Filtru", 100);
    panel.add(label1);
    panel.add(filtru);
    add(panel);

    cancel.setActionCommand("CANCEL_DIALOG");
    cancel.addActionListener(GUIUtil.main);
    see.addActionListener(this);
  }
Esempio n. 19
0
  public void createGUI() {
    typeSelection = new JComboBox(MappingTypes.values());
    fieldSelection = new JComboBox(columnsToBeMappedTo);
    literalEntry = new RoundedJTextField(10);
    literalEntry.setText("-");

    // set the appearance for ach of the fields!
    UIHelper.renderComponent(typeSelection, UIHelper.VER_10_PLAIN, UIHelper.GREY_COLOR, false);
    UIHelper.setJComboBoxAsHeavyweight(typeSelection);
    UIHelper.renderComponent(fieldSelection, UIHelper.VER_10_PLAIN, UIHelper.GREY_COLOR, false);
    UIHelper.setJComboBoxAsHeavyweight(fieldSelection);
    UIHelper.renderComponent(literalEntry, UIHelper.VER_10_PLAIN, UIHelper.GREY_COLOR, false);

    typeSelection.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            if (typeSelection.getSelectedIndex() == -1) {
              typeSelection.setSelectedIndex(0);
            }
            showHideFields();
          }
        });

    fieldSelection.setPreferredSize(new Dimension(130, 25));

    fieldDrop = createTableBrowseDropdown(fieldSelection);

    fieldDrop.setPreferredSize(new Dimension(160, 25));

    changeableContentContainer = new JPanel();
    changeableContentContainer.setLayout(
        new BoxLayout(changeableContentContainer, BoxLayout.LINE_AXIS));
    changeableContentContainer.setPreferredSize(new Dimension(160, 25));

    add(typeSelection);
    add(changeableContentContainer);

    if (preExistingMapping != null) {
      typeSelection.setSelectedItem(preExistingMapping.getType());

      // check if columns available contains the item it is to be set to.
      if (preExistingMapping.getType() == MappingTypes.LITERAL) {
        literalEntry.setText(preExistingMapping.getMapping());
      } else {
        if (checkFieldExists(preExistingMapping.getMapping())) {
          fieldSelection.setSelectedItem(preExistingMapping.getMapping());
        }
      }
    }

    showHideFields();

    ImageIcon imageToUse = (lastInList) ? addButtonIcon : removeButtonIcon;

    addRemoveMappingChoice = new JLabel(imageToUse);
    addRemoveMappingChoice.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseExited(MouseEvent mouseEvent) {
            if (addRemoveMappingChoice.isEnabled()) {
              addRemoveMappingChoice.setIcon(lastInList ? addButtonIcon : removeButtonIcon);
            }
          }

          @Override
          public void mouseEntered(MouseEvent mouseEvent) {
            if (addRemoveMappingChoice.isEnabled()) {
              addRemoveMappingChoice.setIcon(lastInList ? addButtonIconOver : removeButtonIconOver);
            }
          }

          public void mousePressed(MouseEvent mouseEvent) {

            if (addRemoveMappingChoice.isEnabled()) {
              if (lastInList) {
                // tell the parent to add a new mapping
                addRemoveMappingChoice.setIcon(addButtonIcon);
                firePropertyChange("addNewMapping", "1", "2");
              } else {
                // tell the parent to remove this mapping!
                firePropertyChange("removeThisMapping", "1", getCurrentInstance());
              }
            }
          }
        });

    add(addRemoveMappingChoice);
  }
Esempio n. 20
0
  public Bajas(Vector<Libro> libros) {
    setTitle("Bajas");
    setModal(true);

    this.libros = libros;

    JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayout(13, 2));

    JPanel panelTmp = new JPanel();
    JLabel etiqueta = new JLabel("Libros");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    librosCombo = new JComboBox<Libro>();
    librosCombo.setPreferredSize(new Dimension(250, 20));
    librosCombo.addActionListener(this);
    panelTmp.add(librosCombo);
    panel1.add(panelTmp);

    // titulo
    panelTmp = new JPanel();
    etiqueta = new JLabel("Título del libro");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tituloLibro = new JTextField(20);
    panelTmp.add(tituloLibro);
    panel1.add(panelTmp);

    // nombres autor
    panelTmp = new JPanel();
    etiqueta = new JLabel("Nombre(s) del Autor");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    autorNombres = new JTextField(20);
    panelTmp.add(autorNombres);
    panel1.add(panelTmp);

    // apellidos
    panelTmp = new JPanel();
    etiqueta = new JLabel("Apellidos del Autor");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    apellidosAutor = new JTextField(20);
    panelTmp.add(apellidosAutor);
    panel1.add(panelTmp);

    // editorial
    panelTmp = new JPanel();
    etiqueta = new JLabel("Editorial");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    nombreEditorial = new JTextField(20);
    panelTmp.add(nombreEditorial);
    panel1.add(panelTmp);

    // año publicacion
    panelTmp = new JPanel();
    etiqueta = new JLabel("Año de publicación");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    añoPublicacion = new JTextField(5);
    panelTmp.add(añoPublicacion);
    panel1.add(panelTmp);

    // lugar de publicacion
    panelTmp = new JPanel();
    etiqueta = new JLabel("Lugar de publicación");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    lugarPublicacion = new JTextField(20);
    panelTmp.add(lugarPublicacion);
    panel1.add(panelTmp);

    // numero de paginas
    panelTmp = new JPanel();
    etiqueta = new JLabel("Número de páginas");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    numeroPaginas = new JTextField(5);
    panelTmp.add(numeroPaginas);
    panel1.add(panelTmp);

    // ISBN
    panelTmp = new JPanel();
    etiqueta = new JLabel("ISBN");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    codigoISBN = new JTextField(20);
    panelTmp.add(codigoISBN);
    panel1.add(panelTmp);

    // idioma de publicacion
    panelTmp = new JPanel();
    etiqueta = new JLabel("Idiomas de publicación");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    inglesCheck = new JCheckBox("Inglés");
    españolCheck = new JCheckBox("Español");
    mandarinCheck = new JCheckBox("Mandarín");
    panelTmp.add(inglesCheck);
    panelTmp.add(españolCheck);
    panelTmp.add(mandarinCheck);
    panel1.add(panelTmp);

    // genero literario
    panelTmp = new JPanel();
    etiqueta = new JLabel("Género");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    generoLiricoRadio = new JRadioButton("Lírico");
    generoNarrativoRadio = new JRadioButton("Narrativo");
    generoDramaRadio = new JRadioButton("Drama");
    ButtonGroup grupo = new ButtonGroup();
    grupo.add(generoLiricoRadio);
    grupo.add(generoNarrativoRadio);
    grupo.add(generoDramaRadio);
    panelTmp.add(generoLiricoRadio);
    panelTmp.add(generoNarrativoRadio);
    panelTmp.add(generoDramaRadio);
    panel1.add(panelTmp);

    // subgenero literario
    panelTmp = new JPanel();
    etiqueta = new JLabel("Subgénero");
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    panelTmp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    subgeneroCombo = new JComboBox<String>();
    subgeneroCombo.setPreferredSize(new Dimension(200, 20));
    panelTmp.add(subgeneroCombo);
    panel1.add(panelTmp);

    // descripcion del libro
    panelTmp = new JPanel();
    etiqueta = new JLabel("Descripción");
    panelTmp.setLayout(new FlowLayout());
    panelTmp.add(etiqueta);
    panel1.add(panelTmp);

    descripcionArea = new JTextArea();
    JScrollPane panelScroll = new JScrollPane(descripcionArea);
    panelScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    panel1.add(panelScroll);

    add(panel1);

    JPanel panel2 = new JPanel();
    eliminarBoton = new JButton("Eliminar");
    panel2.setLayout(new FlowLayout());
    eliminarBoton.addActionListener(this);
    panel2.add(eliminarBoton);
    add(panel2, BorderLayout.SOUTH);

    inicializar();
    // mostrarLibro();
    setSize(750, 600);
    setLocationRelativeTo(null);
    setResizable(false);
    setVisible(true);
  }