示例#1
0
    public void Dragon() {
      String message =
          "You have come face to face with Darth Vader."; // "You have awoken the sleeping dragon!
      // What will you do?";
      String title = "DARTH VADER!!!"; // "DRAGON!!!";

      usesword = "Use Light Saber"; // "Use Magic Sword";
      usedagger = "Use Glowing Hulk Mask";
      runaway = "Retreat!";
      final JButton retreat = new JButton(runaway);
      retreat.setCursor(new Cursor(Cursor.HAND_CURSOR));
      retreat.addActionListener(this);
      final JButton dagger = new JButton(usedagger);
      dagger.setCursor(new Cursor(Cursor.HAND_CURSOR));
      dagger.addActionListener(this);
      final JButton kill = new JButton(usesword);
      kill.setCursor(new Cursor(Cursor.HAND_CURSOR));
      kill.addActionListener(this);

      Object[] options = {kill, dagger, retreat};
      dragon.showOptionDialog(
          dragon,
          message,
          title,
          JOptionPane.YES_NO_CANCEL_OPTION,
          JOptionPane.QUESTION_MESSAGE,
          (new ImageIcon("MapPics/Vader.png")),
          options,
          options[2]);
    }
示例#2
0
  public Perfil() {
    super.setBounds(181, 61, 700, 538); // (ancho,alto)
    super.setLayout(null);
    super.setOpaque(false);
    super.setVisible(false);

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    jbtnGuardar = new JButton("Guardar Cambios");
    jbtnGuardar.setBounds(55, 457, 150, 40);
    jbtnGuardar.addActionListener(this);
    jbtnGuardar.setBorder(null);
    jbtnGuardar.setBackground(new Color(0, 154, 225));
    jbtnGuardar.setForeground(Color.WHITE);
    jbtnGuardar.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnGuardar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnGuardar.setFocusPainted(false);
    this.add(jbtnGuardar);

    nombre = new JLabel("Ninguna imagen seleccionada");
    nombre.setBounds(210, 250, 200, 40);
    nombre.setForeground(Color.GRAY);
    this.add(nombre);

    jbtnCargarI = new JButton("Cargar imagen");
    jbtnCargarI.setBounds(55, 250, 150, 40);
    jbtnCargarI.addActionListener(this);
    jbtnCargarI.setBorder(null);
    jbtnCargarI.setBackground(new Color(0, 154, 225));
    jbtnCargarI.setForeground(Color.WHITE);
    jbtnCargarI.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnCargarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnCargarI.setFocusPainted(false);
    this.add(jbtnCargarI);

    jbtnQuitarI = new JButton("Quitar imagen");
    jbtnQuitarI.setBounds(55, 186, 150, 40);
    jbtnQuitarI.addActionListener(this);
    jbtnQuitarI.setBorder(null);
    jbtnQuitarI.setBackground(new Color(0, 154, 225));
    jbtnQuitarI.setForeground(Color.WHITE);
    jbtnQuitarI.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnQuitarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnQuitarI.setFocusPainted(false);
    this.add(jbtnQuitarI);

    jlbimage = new JLabel();
    jlbimage.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    jlbimage.setBounds(55, 46, 150, 150);
    this.add(jlbimage);

    this.repaint();
  }
示例#3
0
文件: Css.java 项目: k9m/simplechat
  public static JButton getButton(String name) {
    JButton component = new JButton(name);
    component.setCursor(CURSOR);

    component.setRolloverEnabled(true);

    return component;
  }
示例#4
0
 @Override
 @SuppressWarnings("unchecked")
 public void installUI(JComponent c) {
   super.installUI(c);
   JXLayer<JComponent> l = (JXLayer<JComponent>) c;
   l.getGlassPane().setLayout(new GridBagLayout());
   l.getGlassPane().add(unlockButton);
   unlockButton.setCursor(Cursor.getDefaultCursor());
 }
  // Takes resource name and returns button
  public JButton createButton(String name, String toolTip) {

    // load the image
    String imagePath = "./resources/" + name + ".png";
    ImageIcon iconRollover = new ImageIcon(imagePath);
    int w = iconRollover.getIconWidth();
    int h = iconRollover.getIconHeight();

    // get the cursor for this button
    Cursor cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);

    // make translucent default image
    Image image = createCompatibleImage(w, h, Transparency.TRANSLUCENT);
    Graphics2D g = (Graphics2D) image.getGraphics();
    Composite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .5f);
    g.setComposite(alpha);
    g.drawImage(iconRollover.getImage(), 0, 0, null);
    g.dispose();
    ImageIcon iconDefault = new ImageIcon(image);

    // make a pressed image
    image = createCompatibleImage(w, h, Transparency.TRANSLUCENT);
    g = (Graphics2D) image.getGraphics();
    g.drawImage(iconRollover.getImage(), 2, 2, null);
    g.dispose();
    ImageIcon iconPressed = new ImageIcon(image);

    // create the button
    JButton button = new JButton();
    button.addActionListener(this);
    button.setIgnoreRepaint(true);
    button.setFocusable(false);
    button.setToolTipText(toolTip);
    button.setBorder(null);
    button.setContentAreaFilled(false);
    button.setCursor(cursor);
    button.setIcon(iconDefault);
    button.setRolloverIcon(iconRollover);
    button.setPressedIcon(iconPressed);

    return button;
  }
示例#6
0
  Spacer(ZoneModel model, int index, SpacerHandle knobHandle) {
    this.model = model;
    this.index = index;
    this.knobHandle = knobHandle;

    knobPainter = new KnobPainter(this);

    setOpaque(false);
    setCursor(SliderCursor);

    initKeyMaps();

    Icon icon = getIcon("unstick");
    Icon pressedIcon = getIcon("unstickPressed");
    Icon highlightIcon = getIcon("unstickHighlight");
    unstickButton = new JButton(icon);
    unstickButton.setSize(icon.getIconWidth(), icon.getIconHeight());
    unstickButton.setPressedIcon(pressedIcon);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setRolloverIcon(highlightIcon);
    unstickButton.setBorder(null);
    unstickButton.putClientProperty(SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE);
    unstickButton.setBorderPainted(false);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setOpaque(false);
    unstickButton.setCursor(ClickCursor);
    unstickButton.setFocusable(false);
    unstickButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            Spacer.this.model.removePoint(Spacer.this.index);
          }
        });
    if (model.containsPoint(index)) {
      add(unstickButton);
    }
    model.addZoneModelListener(this);

    setFocusable(true);
    addFocusListener(this);
    addMouseListener(this);
  }
  /**
   * Creates and return an instance of JButton that can be used to collapse the right component in
   * the metal split pane.
   */
  protected JButton createRightOneTouchButton() {
    JButton b =
        new JButton() {
          // Sprite buffer for the arrow image of the right button
          int[][] buffer = {
            {2, 2, 2, 2, 2, 2, 2, 2},
            {0, 1, 1, 1, 1, 1, 1, 3},
            {0, 0, 1, 1, 1, 1, 3, 0},
            {0, 0, 0, 1, 1, 3, 0, 0},
            {0, 0, 0, 0, 3, 0, 0, 0}
          };

          public void setBorder(Border border) {}

          public void paint(Graphics g) {
            JSplitPane splitPane = getSplitPaneFromSuper();
            if (splitPane != null) {
              int oneTouchSize = getOneTouchSizeFromSuper();
              int orientation = getOrientationFromSuper();
              int blockSize = Math.min(getDividerSize(), oneTouchSize);

              // Initialize the color array
              Color[] colors = {
                this.getBackground(),
                MetalLookAndFeel.getPrimaryControlDarkShadow(),
                MetalLookAndFeel.getPrimaryControlInfo(),
                MetalLookAndFeel.getPrimaryControlHighlight()
              };

              // Fill the background first ...
              g.setColor(this.getBackground());
              if (isOpaque()) {
                g.fillRect(0, 0, this.getWidth(), this.getHeight());
              }

              // ... then draw the arrow.
              if (getModel().isPressed()) {
                // Adjust color mapping for pressed button state
                colors[1] = colors[2];
              }
              if (orientation == JSplitPane.VERTICAL_SPLIT) {
                // Draw the image for a vertical split
                for (int i = 1; i <= buffer[0].length; i++) {
                  for (int j = 1; j < blockSize; j++) {
                    if (buffer[j - 1][i - 1] == 0) {
                      continue;
                    } else {
                      g.setColor(colors[buffer[j - 1][i - 1]]);
                    }
                    g.drawLine(i, j, i, j);
                  }
                }
              } else {
                // Draw the image for a horizontal split
                // by simply swaping the i and j axis.
                // Except the drawLine() call this code is
                // identical to the code block above. This was done
                // in order to remove the additional orientation
                // check for each pixel.
                for (int i = 1; i <= buffer[0].length; i++) {
                  for (int j = 1; j < blockSize; j++) {
                    if (buffer[j - 1][i - 1] == 0) {
                      // Nothing needs
                      // to be drawn
                      continue;
                    } else {
                      // Set the color from the
                      // color map
                      g.setColor(colors[buffer[j - 1][i - 1]]);
                    }
                    // Draw a pixel
                    g.drawLine(j, i, j, i);
                  }
                }
              }
            }
          }

          // Don't want the button to participate in focus traversable.
          public boolean isFocusTraversable() {
            return false;
          }
        };
    b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    b.setFocusPainted(false);
    b.setBorderPainted(false);
    b.setRequestFocusEnabled(false);
    maybeMakeButtonOpaque(b);
    return b;
  }
示例#8
0
    public void actionPerformed(ActionEvent e) {
      String t = fid.getText();
      // char[] t2=fpass.getPassword();
      String t2 = fpass.getText();

      try {
        DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
        Connection con =
            DriverManager.getConnection(
                "jdbc:oracle:thin:@localhost:1521:xe", "system", "9696030257");
        Statement st = con.createStatement();
        ResultSet rs =
            st.executeQuery(
                "select * from database where userid='" + t + "' AND password='******'");
        rs.next();
        String g = rs.getString("userid");
        String h = rs.getString("password");
        String i = rs.getString("mob");
        String j = rs.getString("dob");
        if (g.equals(t) && h.equals(t2)) {
          // JOptionPane.showMessageDialog(null,"WoW  !!  You  Are  a  Valid  User");
          JFrame jf1 = new JFrame("About Saras");
          jf1.setBounds(500, 40, 500, 500);
          jf1.setVisible(true);
          jf1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          jf1.setLayout(null);
          String ab =
              "\n\nHis Name is Saraswatendra Singh.\nHe is pursuing B.Tech from ABES Engineering College(032) Ghaziabad U.P.\nHe is belong from VARANASI which is also called BANARAS.\nHis Email and Facebook id is  <*****@*****.**>\n\n\n \t\t\tTHANK YOU";
          String bc =
              "\n\n\nABOUT YOU:-\n\n\t UserId is < "
                  + g
                  + " >\n\t Password is <"
                  + h
                  + " > \n\t Mobile No is < "
                  + i
                  + " >\n\t Date Of Birth(dd/mm/yyyy) is < "
                  + j
                  + " >\n \n\nABOUT DEVELOPER:-"
                  + ab;
          JTextArea about = new JTextArea(bc);
          jf1.add(about);
          about.setBounds(0, 0, 500, 500);
          JButton rest = new JButton("ResetPassword");
          about.add(rest);
          rest.setBounds(30, 400, 150, 20);
          Cursor k1 = new Cursor(Cursor.HAND_CURSOR);
          rest.setCursor(k1);
          rest.addActionListener(new ResetPassword());
          JButton restmob = new JButton("ResetMobileNo");
          about.add(restmob);
          restmob.setBounds(230, 400, 150, 20);
          Cursor k2 = new Cursor(Cursor.HAND_CURSOR);
          restmob.setCursor(k2);
          restmob.addActionListener(new ResetMob());
        }
      } catch (Exception ex) {
        System.out.print(ex);
        JOptionPane.showMessageDialog(
            null,
            "UserId  or  Password  MissMatched !!!  please  Enter  Valid  UserId and Password");
      }
    }
示例#9
0
  public Viajes() {
    super.setBounds(181, 61, 700, 538); // (ancho,alto)
    super.setLayout(null);
    super.setOpaque(false);
    super.setVisible(false);

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    tbDatos = new JTable(dataModel);
    tbDatos.setEnabled(false);
    tbDatos.setAutoResizeMode(5);
    tbDatos.setCellSelectionEnabled(true);
    tbDatos.setForeground(Color.BLACK);
    pnDatos = new JScrollPane(tbDatos);
    pnDatos.setBounds(30, 30, 640, 478);
    pnDatos.setVisible(false);
    this.add(pnDatos);
    llenarDatos();

    jlbCodigo = new JLabel("*Código");
    jlbCodigo.setBounds(90, 100, 220, 25);
    jlbCodigo.setForeground(Color.BLACK);
    jlbCodigo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbCodigo);

    jtxtCodigo = new JTextField("");
    jtxtCodigo.setBounds(90, 125, 520, 30);
    jtxtCodigo.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    jtxtCodigo.addKeyListener(this);
    this.add(jtxtCodigo);

    jlbOrigen = new JLabel("*Origen");
    jlbOrigen.setBounds(90, 180, 150, 25);
    jlbOrigen.setForeground(Color.BLACK);
    jlbOrigen.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbOrigen);

    jcbOrigen = new JComboBox();
    jcbOrigen.setBorder(null);
    jcbOrigen.setBackground(Color.WHITE);
    jcbOrigen.addItem("Medellín");
    jcbOrigen.addItem("Bogotá");
    jcbOrigen.addItem("Barranquilla");
    jcbOrigen.setBounds(90, 205, 250, 30);
    this.add(jcbOrigen);

    jlbDestino = new JLabel("*Destino");
    jlbDestino.setBounds(360, 180, 150, 25);
    jlbDestino.setForeground(Color.BLACK);
    jlbDestino.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbDestino);

    jcbDestino = new JComboBox();
    jcbDestino.setBorder(null);
    jcbDestino.setBackground(Color.WHITE);
    jcbDestino.addItem("Bogotá");
    jcbDestino.addItem("Medellín");
    jcbDestino.addItem("Barranquilla");
    jcbDestino.setBounds(360, 205, 250, 30);
    this.add(jcbDestino);

    jlbPrecio = new JLabel("*Precio");
    jlbPrecio.setBounds(90, 260, 120, 25);
    jlbPrecio.setForeground(Color.BLACK);
    jlbPrecio.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbPrecio);

    jtxtPrecio = new JTextField("");
    jtxtPrecio.setBounds(90, 285, 520, 30);
    jtxtPrecio.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    jtxtPrecio.addKeyListener(this);
    this.add(jtxtPrecio);

    jlbEstado = new JLabel("*Estado");
    jlbEstado.setBounds(90, 340, 150, 25);
    jlbEstado.setForeground(Color.BLACK);
    jlbEstado.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbEstado);

    jcbEstado = new JComboBox();
    jcbEstado.setBorder(null);
    jcbEstado.setBackground(Color.WHITE);
    jcbEstado.addItem("Activo");
    jcbEstado.addItem("Inactivo");
    jcbEstado.setBounds(90, 365, 520, 30);
    this.add(jcbEstado);

    jbtnListar = new JButton(" Lista");
    jbtnListar.setBounds(0, 0, 233, 60);
    jbtnListar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/icons/List-26.png")));
    jbtnListar.setBorder(null);
    jbtnListar.setBackground(new Color(0, 154, 225));
    jbtnListar.setForeground(Color.WHITE);
    jbtnListar.setFont(new Font("Segoe UI", Font.PLAIN, 20));
    jbtnListar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnListar.addMouseListener(this);
    jbtnListar.addActionListener(this);
    jbtnListar.setFocusPainted(false);
    this.add(jbtnListar);

    jbtnBuscar = new JButton(" Buscar");
    jbtnBuscar.setBounds(233, 0, 234, 60);
    jbtnBuscar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/icons/Search-26.png")));
    jbtnBuscar.setBorder(null);
    jbtnBuscar.setBackground(new Color(0, 154, 225));
    jbtnBuscar.setForeground(Color.WHITE);
    jbtnBuscar.setFont(new Font("Segoe UI", Font.PLAIN, 20));
    jbtnBuscar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnBuscar.addMouseListener(this);
    jbtnBuscar.addActionListener(this);
    jbtnBuscar.setFocusPainted(false);
    this.add(jbtnBuscar);

    jbtnActualizar = new JButton(" Actualizar");
    jbtnActualizar.setBounds(233, 0, 234, 60);
    jbtnActualizar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/icons/Edit-26.png")));
    jbtnActualizar.setBorder(null);
    jbtnActualizar.setBackground(new Color(0, 154, 225));
    jbtnActualizar.setForeground(Color.WHITE);
    jbtnActualizar.setFont(new Font("Segoe UI", Font.PLAIN, 20));
    jbtnActualizar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnActualizar.addMouseListener(this);
    jbtnActualizar.setVisible(false);
    jbtnActualizar.addActionListener(this);
    jbtnActualizar.setFocusPainted(false);
    this.add(jbtnActualizar);

    jbtnLimpiar = new JButton(" Limpiar");
    jbtnLimpiar.setBounds(467, 0, 233, 60);
    jbtnLimpiar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/icons/Clean-26.png")));
    jbtnLimpiar.setBorder(null);
    jbtnLimpiar.setBackground(new Color(0, 154, 225));
    jbtnLimpiar.setForeground(Color.WHITE);
    jbtnLimpiar.setFont(new Font("Segoe UI", Font.PLAIN, 20));
    jbtnLimpiar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnLimpiar.addMouseListener(this);
    jbtnLimpiar.addActionListener(this);
    jbtnLimpiar.setFocusPainted(false);
    this.add(jbtnLimpiar);

    jpBotones = new JPanel();
    jpBotones.setBackground(new Color(0, 123, 183));
    jpBotones.add(jbtnListar);
    jpBotones.add(jbtnBuscar);
    jpBotones.add(jbtnActualizar);
    jpBotones.add(jbtnLimpiar);
    jpBotones.setLayout(null);
    jpBotones.setBounds(0, 478, 700, 60);
    this.add(jpBotones);

    jlbValidar = new JLabel("Los campos con (*) son obligatorios");
    jlbValidar.setForeground(Color.WHITE);
    jlbValidar.setBounds(80, 8, 300, 27);
    jlbValidar.setFont(new Font("Segoe UI", Font.PLAIN, 17));
    this.add(jlbValidar);

    jpError = new JPanel();
    jpError.add(jlbValidar);
    jpError.setLayout(null);
    jpError.setBackground(new Color(0, 123, 183));
    jpError.setBounds(0, 0, 700, 45);
    this.add(jpError);

    this.repaint();
  }
  @SuppressWarnings("serial")
  public JTableRenderer(final Object cell, final GraphComponent graphContainer) {
    this.cell = cell;
    this.graphContainer = graphContainer;
    this.graph = graphContainer.getGraph();
    setLayout(new BorderLayout());
    setBorder(
        BorderFactory.createCompoundBorder(
            ShadowBorder.getSharedInstance(), BorderFactory.createBevelBorder(BevelBorder.RAISED)));

    JPanel title = new JPanel();
    title.setBackground(new Color(149, 173, 239));
    title.setOpaque(true);
    title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
    title.setLayout(new BorderLayout());

    JLabel icon =
        new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "preferences.gif")));
    icon.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 1));
    title.add(icon, BorderLayout.WEST);

    JLabel label = new JLabel(String.valueOf(graph.getLabel(cell)));
    label.setForeground(Color.WHITE);
    label.setFont(title.getFont().deriveFont(Font.BOLD, 11));
    label.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 2));
    title.add(label, BorderLayout.CENTER);

    JPanel toolBar2 = new JPanel();
    toolBar2.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 2));
    toolBar2.setOpaque(false);
    JButton button =
        new JButton(
            new AbstractAction(
                "", new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "minimize.gif"))) {

              public void actionPerformed(ActionEvent e) {
                graph.foldCells(graph.isCellCollapsed(cell), false, new Object[] {cell});
                ((JButton) e.getSource())
                    .setIcon(
                        new ImageIcon(
                            JTableRenderer.class.getResource(
                                IMAGE_PATH
                                    + ((graph.isCellCollapsed(cell))
                                        ? "maximize.gif"
                                        : "minimize.gif"))));
              }
            });
    button.setPreferredSize(new Dimension(16, 16));
    button.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    button.setToolTipText("Collapse/Expand");
    button.setOpaque(false);
    toolBar2.add(button);

    title.add(toolBar2, BorderLayout.EAST);
    add(title, BorderLayout.NORTH);

    // CellStyle style =
    // graph.getStylesheet().getCellStyle(graph.getModel(),
    // cell);
    // if (style.getStyleClass() == null) {
    table = new MyTable();
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

    if (graph.getModel().getChildCount(cell) == 0) {
      scrollPane.getViewport().setBackground(Color.WHITE);
      setOpaque(true);
      add(scrollPane, BorderLayout.CENTER);
    }

    scrollPane
        .getVerticalScrollBar()
        .addAdjustmentListener(
            new AdjustmentListener() {

              public void adjustmentValueChanged(AdjustmentEvent e) {
                graphContainer.refresh();
              }
            });

    label = new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "resize.gif")));
    label.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(label, BorderLayout.EAST);

    add(panel, BorderLayout.SOUTH);

    ResizeHandler resizeHandler = new ResizeHandler();
    label.addMouseListener(resizeHandler);
    label.addMouseMotionListener(resizeHandler);

    setMinimumSize(new Dimension(20, 30));
  }
示例#11
0
  public void createGUI() {
    setLayout(new BorderLayout());
    JPanel topPan = new JPanel(new BorderLayout());
    //        topPan.setBorder(BorderFactory.createRaisedSoftBevelBorder());
    JPanel topCentPan = new JPanel();
    JLabel titleLab = new JLabel();
    titleLab.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
    topCentPan.add(titleLab);

    JPanel topRightPan = new JPanel();
    //        Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
    replyBut = new JButton(new ImageIcon("src\\images\\replyIcon.png"));
    replyBut.setBorder(BorderFactory.createEmptyBorder());
    replyBut.addActionListener(this);
    replyBut.setCursor(new Cursor(Cursor.HAND_CURSOR));
    replyBut.setToolTipText("Reply");
    replyBut.setContentAreaFilled(false);
    replyBut.setRolloverEnabled(true);
    forwardBut = new JButton(new ImageIcon("src\\images\\forwardIcon.png"));
    forwardBut.setBorder(BorderFactory.createEmptyBorder());
    forwardBut.addActionListener(this);
    forwardBut.setCursor(new Cursor(Cursor.HAND_CURSOR));
    forwardBut.setToolTipText("Forward");
    forwardBut.setContentAreaFilled(false);
    forwardBut.setRolloverEnabled(true);
    topRightPan.add(replyBut);
    topRightPan.add(forwardBut);
    topPan.add(topCentPan, "Center");
    topPan.add(topRightPan, "East");

    JPanel centPan = new JPanel(new BorderLayout());
    JPanel centTopPan = new JPanel(new BorderLayout());
    JPanel centTopLeftPan = new JPanel();
    JLabel fromLab = new JLabel();
    fromLab.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 12));
    JTextArea contentTA = new JTextArea();
    //            JEditorPane contentTA = new JEditorPane(JEditorPane.W3C_LENGTH_UNITS,"");
    contentTA.setLineWrap(true);
    contentTA.setEditable(false);
    centTopLeftPan.add(fromLab);
    JPanel centTopRightPan = new JPanel();
    JLabel dateLab = new JLabel();
    dateLab.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    centTopRightPan.add(dateLab);
    centTopPan.add(centTopLeftPan, "West");
    centTopPan.add(centTopRightPan, "East");
    centPan.add(centTopPan, "North");
    centPan.add(new JScrollPane(contentTA), "Center");

    add(topPan, "North");
    add(centPan, "Center");

    try {
      workingSet.absolute(pointer + 1);
      msgID = Home.bodyPan.msgID[pointer];
      titleLab.setText(workingSet.getString("subject"));
      fromLab.setText("From: " + workingSet.getString("mail_addresses"));
      dateLab.setText(workingSet.getString("sent_date"));
      contentTA.setText(workingSet.getString("content"));
    } catch (SQLException sqlExc) {
      JOptionPane.showMessageDialog(this, sqlExc, "EXCEPTION", JOptionPane.ERROR_MESSAGE);
    }
    Home.bodyPan.remove(Home.bodyPan.contentPan);
    Home.bodyPan.contentPan = new JScrollPane(this);
    Home.bodyPan.add(Home.bodyPan.contentPan);
    Home.home.homeFrame.setVisible(true);
  }
示例#12
0
  public LoginPanel(Image img, ActionListener listener) {
    super(null);
    this.listener = listener;
    if (img == null) {
      InputStream inData = getClass().getResourceAsStream("/resources/background.gif");
      BufferedImage back = null;
      if (inData != null)
        try {
          back = ImageIO.read(inData);
        } catch (IOException e) {
          loger.finest("LoginPanel class can't get the background image");
        }
      this.background = back;
    }

    setLayout(null);
    JPanel logingPanel = new JPanel();
    loginTitle = new JLabel("Autentificare");
    logingPanel.setSize(250, 150);
    logingPanel.setBorder(new javax.swing.border.LineBorder(Color.black, 2));
    logingPanel.setLayout(null);
    loginTitle.setBounds(3, 0, logingPanel.getWidth(), 20);
    logingPanel.add(loginTitle);
    JLabel loginUser = new JLabel("Utilizator");
    loginUser.setBounds(
        80 - loginUser.getPreferredSize().width,
        40,
        loginUser.getPreferredSize().width,
        loginUser.getPreferredSize().height);
    logingPanel.add(loginUser);
    user = new JTextField(10);
    user.setBounds(85, 40, user.getPreferredSize().width, user.getPreferredSize().height);
    // user.setText("test");
    // loginUser.setLabelFor(user);
    logingPanel.add(user);
    JLabel loginPass = new JLabel("Parola");
    loginPass.setBounds(
        80 - loginPass.getPreferredSize().width,
        80,
        loginPass.getPreferredSize().width,
        loginPass.getPreferredSize().height);
    logingPanel.add(loginPass);
    // JTextField pass = new JTextField(10);
    pass = new JPasswordField(10);
    pass.setBounds(85, 80, pass.getPreferredSize().width, pass.getPreferredSize().height);
    pass.addKeyListener(this);
    // pass.setText("test");
    // loginUser.setLabelFor(user);
    logingPanel.add(pass);
    JButton loginButton = new JButton("Start");
    loginButton.setActionCommand("LOGIN");
    loginButton.setBounds(
        60, 110, loginButton.getPreferredSize().width, loginButton.getPreferredSize().height);
    // loginButton.setOpaque(false);
    loginButton.setFocusPainted(false);
    // loginButton.setContentAreaFilled(false);
    // loginButton.setBorderPainted(false);
    loginButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    loginButton.addActionListener(listener);
    logingPanel.add(loginButton);

    add(logingPanel);
  }