@Override
  protected void installDefaults(AbstractButton b) {
    super.installDefaults(b);

    String pp = getPropertyPrefix();
    // b.setOpaque(QuaquaManager.getBoolean(pp+"opaque"));
    QuaquaUtilities.installProperty(b, "opaque", UIManager.get(pp + "opaque"));
    b.setRequestFocusEnabled(UIManager.getBoolean(pp + "requestFocusEnabled"));
    b.setFocusable(UIManager.getBoolean(pp + "focusable"));
  }
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   if (frame.isSelected()) {
     g.setColor(UIManager.getColor("activeCaptionText"));
   } else {
     g.setColor(UIManager.getColor("inactiveCaptionText"));
   }
   Dimension d = getSize();
   String frameTitle = frame.getTitle();
   if (frameTitle != null) {
     MotifGraphicsUtils.drawStringInRect(
         frame, g, frameTitle, 0, 0, d.width, d.height, SwingConstants.CENTER);
   }
 }
 @Override
 public Dimension getMinimumSize(JComponent c) {
   AbstractButton b = (AbstractButton) c;
   String style = (String) c.getClientProperty("Quaqua.Button.style");
   if (style == null) {
     style = "push";
   }
   if (style.equals("help")) {
     return getPreferredSize(c);
   }
   Dimension d = super.getMinimumSize(c);
   if (isFixedHeight(c)) {
     Dimension p = getPreferredSize(c);
     if (d != null && p != null) {
       d.height = Math.max(d.height, p.height);
     }
   }
   if (!QuaquaUtilities.isSmallSizeVariant(c)
       && style.equals("push") //
       && b.getIcon() == null
       && b.getText() != null) {
     if (d != null) {
       d.width = Math.max(d.width, UIManager.getInt("Button.minimumWidth"));
     }
   }
   return d;
 }
 public static void createAndShowGUI() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   }
   JFrame frame = new JFrame("@title@");
   frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   frame.getContentPane().add(new MainPanel());
   frame.pack();
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
Exemple #5
0
 // ********************************
 //          Defaults
 // ********************************
 public void installDefaults(AbstractButton b) {
   super.installDefaults(b);
   if (!defaults_initialized) {
     icon = UIManager.getIcon(getPropertyPrefix() + "icon");
     defaults_initialized = true;
   }
 }
  /**
   * Method which renders the text of the current button.
   *
   * <p>
   *
   * @param g Graphics context
   * @param b Current button to render
   * @param textRect Bounding rectangle to render the text.
   * @param text String to render
   * @since 1.4
   */
  @Override
  protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) {
    ButtonModel model = b.getModel();
    FontMetrics fm = g.getFontMetrics();
    int mnemonicIndex = Methods.invokeGetter(b, "getDisplayedMnemonicIndex", -1);
    boolean borderHasPressedCue = borderHasPressedCue(b);

    /* Draw the Text */
    if (model.isPressed() && model.isArmed() && !borderHasPressedCue) {
      g.setColor(new Color(0xa0000000, true));
      QuaquaUtilities.drawStringUnderlineCharAt(
          g,
          text,
          mnemonicIndex,
          textRect.x + getTextShiftOffset(),
          textRect.y + fm.getAscent() + getTextShiftOffset() + 1);
    }

    if (model.isEnabled()) {
      /** * paint the text normally */
      g.setColor(b.getForeground());
    } else {
      Color c = UIManager.getColor(getPropertyPrefix() + "disabledForeground");
      g.setColor((c != null) ? c : b.getForeground());
    }
    QuaquaUtilities.drawStringUnderlineCharAt(
        g,
        text,
        mnemonicIndex,
        textRect.x + getTextShiftOffset(),
        textRect.y + fm.getAscent() + getTextShiftOffset());
  }
 public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) {
   ListCellRenderer renderer = comboBox.getRenderer();
   Component c;
   Dimension d;
   c =
       renderer.getListCellRendererComponent(
           listBox, comboBox.getSelectedItem(), -1, false, false);
   c.setFont(comboBox.getFont());
   if (comboBox.isEnabled()) {
     c.setForeground(comboBox.getForeground());
     c.setBackground(comboBox.getBackground());
   } else {
     c.setForeground(UIManager.getColor("ComboBox.disabledForeground"));
     c.setBackground(UIManager.getColor("ComboBox.disabledBackground"));
   }
   d = c.getPreferredSize();
   currentValuePane.paintComponent(g, c, comboBox, bounds.x, bounds.y, bounds.width, d.height);
 }
    Title(String title) {
      super();
      setText(title);
      setHorizontalAlignment(SwingConstants.CENTER);
      setBorder(
          BorderFactory.createBevelBorder(
              BevelBorder.RAISED,
              UIManager.getColor("activeCaptionBorder"),
              UIManager.getColor("inactiveCaptionBorder")));

      // Forward mouse events to titlebar for moves.
      addMouseMotionListener(
          new MouseMotionListener() {
            public void mouseDragged(MouseEvent e) {
              forwardEventToParent(e);
            }

            public void mouseMoved(MouseEvent e) {
              forwardEventToParent(e);
            }
          });
      addMouseListener(
          new MouseListener() {
            public void mouseClicked(MouseEvent e) {
              forwardEventToParent(e);
            }

            public void mousePressed(MouseEvent e) {
              forwardEventToParent(e);
            }

            public void mouseReleased(MouseEvent e) {
              forwardEventToParent(e);
            }

            public void mouseEntered(MouseEvent e) {
              forwardEventToParent(e);
            }

            public void mouseExited(MouseEvent e) {
              forwardEventToParent(e);
            }
          });
    }
  public void installUI(JComponent c) {
    super.installUI(c);
    arrowIcon =
        new MotifComboBoxArrowIcon(
            UIManager.getColor("controlHighlight"),
            UIManager.getColor("controlShadow"),
            UIManager.getColor("control"));

    Runnable initCode =
        new Runnable() {
          public void run() {
            if (motifGetEditor() != null) {
              motifGetEditor().setBackground(UIManager.getColor("text"));
            }
          }
        };

    SwingUtilities.invokeLater(initCode);
  }
  protected void installStrings(JFileChooser fc) {
    super.installStrings(fc);

    Locale l = fc.getLocale();

    enterFileNameLabelText = UIManager.getString("FileChooser.enterFileNameLabelText", l);
    enterFileNameLabelMnemonic = UIManager.getInt("FileChooser.enterFileNameLabelMnemonic");

    filesLabelText = UIManager.getString("FileChooser.filesLabelText", l);
    filesLabelMnemonic = UIManager.getInt("FileChooser.filesLabelMnemonic");

    foldersLabelText = UIManager.getString("FileChooser.foldersLabelText", l);
    foldersLabelMnemonic = UIManager.getInt("FileChooser.foldersLabelMnemonic");

    pathLabelText = UIManager.getString("FileChooser.pathLabelText", l);
    pathLabelMnemonic = UIManager.getInt("FileChooser.pathLabelMnemonic");

    filterLabelText = UIManager.getString("FileChooser.filterLabelText", l);
    filterLabelMnemonic = UIManager.getInt("FileChooser.filterLabelMnemonic");
  }
  public void paint(Graphics g, JComponent c) {
    boolean hasFocus = comboBox.hasFocus();
    Rectangle r;

    if (comboBox.isEnabled()) {
      g.setColor(comboBox.getBackground());
    } else {
      g.setColor(UIManager.getColor("ComboBox.disabledBackground"));
    }
    g.fillRect(0, 0, c.getWidth(), c.getHeight());

    if (!comboBox.isEditable()) {
      r = rectangleForCurrentValue();
      paintCurrentValue(g, r, hasFocus);
    }
    r = rectangleForArrowIcon();
    arrowIcon.paintIcon(c, g, r.x, r.y);
    if (!comboBox.isEditable()) {
      Border border = comboBox.getBorder();
      Insets in;
      if (border != null) {
        in = border.getBorderInsets(comboBox);
      } else {
        in = new Insets(0, 0, 0, 0);
      }
      // Draw the separation
      if (MotifGraphicsUtils.isLeftToRight(comboBox)) {
        r.x -= (HORIZ_MARGIN + 2);
      } else {
        r.x += r.width + HORIZ_MARGIN + 1;
      }
      r.y = in.top;
      r.width = 1;
      r.height = comboBox.getBounds().height - in.bottom - in.top;
      g.setColor(UIManager.getColor("controlShadow"));
      g.fillRect(r.x, r.y, r.width, r.height);
      r.x++;
      g.setColor(UIManager.getColor("controlHighlight"));
      g.fillRect(r.x, r.y, r.width, r.height);
    }
  }
 /** {@inheritDoc} */
 @Override
 protected void installListeners(JScrollPane c) {
   super.installListeners(c);
   c.addPropertyChangeListener(this);
   if (UIManager.getBoolean("ScrollPane.useChildTextComponentFocus")) {
     viewportViewFocusHandler = new ViewportViewFocusHandler();
     c.getViewport().addContainerListener(viewportViewFocusHandler);
     Component view = c.getViewport().getView();
     if (view instanceof JTextComponent) {
       view.addFocusListener(viewportViewFocusHandler);
     }
   }
 }
Exemple #13
0
  /**
   * Create a component that will replace the spinner models value with the object returned by
   * <code>spinner.getNextValue</code>. By default the <code>nextButton</code> is a JButton who's
   * <code>ActionListener</code> updates it's <code>JSpinner</code> ancestors model. If a nextButton
   * isn't needed (in a subclass) then override this method to return null.
   *
   * @return a component that will replace the spinners model with the next value in the sequence,
   *     or null
   * @see #installUI
   * @see #createPreviousButton
   */
  protected Component createNextButton() {
    Component tmpButton = super.createNextButton();

    if (tmpButton instanceof JButton) {
      JButton result = new ArrowButton(SwingConstants.NORTH);
      ((ArrowButton) result).setDrawBottomBorder(false);

      result.setBorder(
          BorderFactory.createMatteBorder(1, 1, 0, 1, UIManager.getColor("Button.borderColor")));
      ActionListener al[] = ((JButton) tmpButton).getActionListeners();
      for (int i = 0; i < al.length; i++) result.addActionListener(al[i]);

      MouseListener ml[] = ((JButton) tmpButton).getMouseListeners();
      for (int i = 0; i < ml.length; i++) result.addMouseListener(ml[i]);

      return result;
    } else return tmpButton;
  }
  @Override
  public void paint(Graphics g, JComponent c) {

    String style = (String) c.getClientProperty("Quaqua.Button.style");
    if (style != null && style.equals("help")) {
      Insets insets = c.getInsets();
      UIManager.getIcon("Button.helpIcon").paintIcon(c, g, insets.left, insets.top);
      return;
    }

    Object oldHints = QuaquaUtilities.beginGraphics((Graphics2D) g);
    if (((AbstractButton) c).isBorderPainted()) {
      Border b = c.getBorder();
      if (b != null && b instanceof BackgroundBorder) {
        ((BackgroundBorder) b)
            .getBackgroundBorder()
            .paintBorder(c, g, 0, 0, c.getWidth(), c.getHeight());
      }
    }
    super.paint(g, c);
    QuaquaUtilities.endGraphics((Graphics2D) g, oldHints);
    Debug.paint(g, c, this);
  }
/**
 * Metal's split pane divider
 *
 * <p><strong>Warning:</strong> Serialized objects of this class will not be compatible with future
 * Swing releases. The current serialization support is appropriate for short term storage or RMI
 * between applications running the same version of Swing. As of 1.4, support for long term storage
 * of all JavaBeans<sup><font size="-2">TM</font></sup> has been added to the <code>java.beans
 * </code> package. Please see {@link java.beans.XMLEncoder}.
 *
 * @author Steve Wilson
 * @author Ralph kar
 */
class MetalSplitPaneDivider extends BasicSplitPaneDivider {
  private MetalBumps bumps =
      new MetalBumps(
          10,
          10,
          MetalLookAndFeel.getControlHighlight(),
          MetalLookAndFeel.getControlDarkShadow(),
          MetalLookAndFeel.getControl());

  private MetalBumps focusBumps =
      new MetalBumps(
          10,
          10,
          MetalLookAndFeel.getPrimaryControlHighlight(),
          MetalLookAndFeel.getPrimaryControlDarkShadow(),
          UIManager.getColor("SplitPane.dividerFocusColor"));

  private int inset = 2;

  private Color controlColor = MetalLookAndFeel.getControl();
  private Color primaryControlColor = UIManager.getColor("SplitPane.dividerFocusColor");

  public MetalSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
  }

  public void paint(Graphics g) {
    MetalBumps usedBumps;
    if (splitPane.hasFocus()) {
      usedBumps = focusBumps;
      g.setColor(primaryControlColor);
    } else {
      usedBumps = bumps;
      g.setColor(controlColor);
    }
    Rectangle clip = g.getClipBounds();
    Insets insets = getInsets();
    g.fillRect(clip.x, clip.y, clip.width, clip.height);
    Dimension size = getSize();
    size.width -= inset * 2;
    size.height -= inset * 2;
    int drawX = inset;
    int drawY = inset;
    if (insets != null) {
      size.width -= (insets.left + insets.right);
      size.height -= (insets.top + insets.bottom);
      drawX += insets.left;
      drawY += insets.top;
    }
    usedBumps.setBumpArea(size);
    usedBumps.paintIcon(this, g, drawX, drawY);
    super.paint(g);
  }

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

          public void setBorder(Border b) {}

          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.setRequestFocusEnabled(false);
    b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    b.setFocusPainted(false);
    b.setBorderPainted(false);
    maybeMakeButtonOpaque(b);
    return b;
  }

  /** If necessary <code>c</code> is made opaque. */
  private void maybeMakeButtonOpaque(JComponent c) {
    Object opaque = UIManager.get("SplitPane.oneTouchButtonsOpaque");
    if (opaque != null) {
      c.setOpaque(((Boolean) opaque).booleanValue());
    }
  }

  /**
   * 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;
  }

  /**
   * Used to layout a MetalSplitPaneDivider. Layout for the divider involves appropriately moving
   * the left/right buttons around.
   *
   * <p>This class should be treated as a &quot;protected&quot; inner class. Instantiate it only
   * within subclasses of MetalSplitPaneDivider.
   */
  public class MetalDividerLayout implements LayoutManager {

    // NOTE NOTE NOTE NOTE NOTE
    // This class is no longer used, the functionality has
    // been rolled into BasicSplitPaneDivider.DividerLayout as a
    // defaults property

    public void layoutContainer(Container c) {
      JButton leftButton = getLeftButtonFromSuper();
      JButton rightButton = getRightButtonFromSuper();
      JSplitPane splitPane = getSplitPaneFromSuper();
      int orientation = getOrientationFromSuper();
      int oneTouchSize = getOneTouchSizeFromSuper();
      int oneTouchOffset = getOneTouchOffsetFromSuper();
      Insets insets = getInsets();

      // This layout differs from the one used in BasicSplitPaneDivider.
      // It does not center justify the oneTouchExpadable buttons.
      // This was necessary in order to meet the spec of the Metal
      // splitpane divider.
      if (leftButton != null && rightButton != null && c == MetalSplitPaneDivider.this) {
        if (splitPane.isOneTouchExpandable()) {
          if (orientation == JSplitPane.VERTICAL_SPLIT) {
            int extraY = (insets != null) ? insets.top : 0;
            int blockSize = getDividerSize();

            if (insets != null) {
              blockSize -= (insets.top + insets.bottom);
            }
            blockSize = Math.min(blockSize, oneTouchSize);
            leftButton.setBounds(oneTouchOffset, extraY, blockSize * 2, blockSize);
            rightButton.setBounds(
                oneTouchOffset + oneTouchSize * 2, extraY, blockSize * 2, blockSize);
          } else {
            int blockSize = getDividerSize();
            int extraX = (insets != null) ? insets.left : 0;

            if (insets != null) {
              blockSize -= (insets.left + insets.right);
            }
            blockSize = Math.min(blockSize, oneTouchSize);
            leftButton.setBounds(extraX, oneTouchOffset, blockSize, blockSize * 2);
            rightButton.setBounds(
                extraX, oneTouchOffset + oneTouchSize * 2, blockSize, blockSize * 2);
          }
        } else {
          leftButton.setBounds(-5, -5, 1, 1);
          rightButton.setBounds(-5, -5, 1, 1);
        }
      }
    }

    public Dimension minimumLayoutSize(Container c) {
      return new Dimension(0, 0);
    }

    public Dimension preferredLayoutSize(Container c) {
      return new Dimension(0, 0);
    }

    public void removeLayoutComponent(Component c) {}

    public void addLayoutComponent(String string, Component c) {}
  }

  /*
   * The following methods only exist in order to be able to access protected
   * members in the superclass, because these are otherwise not available
   * in any inner class.
   */

  int getOneTouchSizeFromSuper() {
    return super.ONE_TOUCH_SIZE;
  }

  int getOneTouchOffsetFromSuper() {
    return super.ONE_TOUCH_OFFSET;
  }

  int getOrientationFromSuper() {
    return super.orientation;
  }

  JSplitPane getSplitPaneFromSuper() {
    return super.splitPane;
  }

  JButton getLeftButtonFromSuper() {
    return super.leftButton;
  }

  JButton getRightButtonFromSuper() {
    return super.rightButton;
  }
}
 /** If necessary <code>c</code> is made opaque. */
 private void maybeMakeButtonOpaque(JComponent c) {
   Object opaque = UIManager.get("SplitPane.oneTouchButtonsOpaque");
   if (opaque != null) {
     c.setOpaque(((Boolean) opaque).booleanValue());
   }
 }
 public void configureEditor() {
   super.configureEditor();
   editor.setBackground(UIManager.getColor("text"));
 }
  editprof(String str, String user) {
    cp = getContentPane();
    cp.setLayout(null);
    user1 = user;
    try {

      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

    } catch (Exception e) {
    }

    JTextField ft = new JTextField();
    name1 = new JLabel("First Name");
    try {
      r = new FileReader(user + "/First name.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    name = new JTextField();
    name.setText(ft.getText());

    last1 = new JLabel("Enter Last Name");
    try {
      r = new FileReader(user + "/last name.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    last = new JTextField();
    last.setText(ft.getText());

    pass = new JLabel("Password");
    try {
      r = new FileReader(user + "/password.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    pwd = new JPasswordField();
    pwd.setText(ft.getText());
    pwd.setEditable(false);

    email1 = new JLabel("Enter email address");
    try {
      r = new FileReader(user + "/email.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    email = new JTextField();
    email.setText(ft.getText());

    addimage = new JButton("Add Image");
    icon = new JLabel();

    date1 = new JLabel("Date Of Birth");
    date = new JComboBox();
    for (int i = 1; i <= 31; i++) {
      date.addItem(i);
    }

    month = new JComboBox();
    month.addItem("Jan");
    month.addItem("Feb");
    month.addItem("Mar");
    month.addItem("Apr");
    month.addItem("May");
    month.addItem("Jun");
    month.addItem("Jul");
    month.addItem("Aug");
    month.addItem("Sep");
    month.addItem("Oct");
    month.addItem("Nov");
    month.addItem("Dec");

    year = new JComboBox();
    for (int j = 1900; j <= 2010; j++) {
      year.addItem(j);
    }

    sx = new JLabel("Gender");
    gen = new JComboBox();
    gen.addItem("Male");
    gen.addItem("Female");

    con1 = new JLabel("Country Name");
    con = new JComboBox();
    con.addItem(" Austrelia");
    con.addItem(" America");
    con.addItem(" Antartica");
    con.addItem(" Africa");
    con.addItem(" Canda");
    con.addItem(" Corea");
    con.addItem(" Chaina");
    con.addItem(" Denmark");
    con.addItem(" England");
    con.addItem(" Franc");
    con.addItem(" Hangery");
    con.addItem(" Holand");
    con.addItem(" Itali");
    con.addItem(" India");
    con.addItem(" Indonesia");
    con.addItem(" Jermany");
    con.addItem(" Japan");
    con.addItem(" Korea");
    con.addItem(" Kembridge");
    con.addItem(" Merusalem");
    con.addItem(" Noth America");
    con.addItem(" Norvey");
    con.addItem(" West Indies");
    con.addItem(" Peru");
    con.addItem(" Zimbawe");

    about = new JLabel("About me");
    try {
      r = new FileReader(user + "/about.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;

    main = new JTextArea();
    main.setText(ft.getText());

    JScrollPane jsp = new JScrollPane(main, v, h);

    allow = new JLabel("Allow To:");
    JCheckBox c1 = new JCheckBox(" orkut Friends");
    JCheckBox c2 = new JCheckBox("Collage Friends");
    JCheckBox c3 = new JCheckBox("Business Partner");
    JCheckBox c4 = new JCheckBox("Relatives");

    col = new JLabel("Collage Name:");
    try {
      r = new FileReader(user + "/Collage.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    col1 = new JTextField();
    col1.setText(ft.getText());
    try {
      r = new FileReader(user + "/UniverSity.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    uni = new JLabel("Univercity");
    uni1 = new JTextField();
    uni1.setText(ft.getText());

    state1 = new JLabel("State Name");
    try {
      r = new FileReader(user + "/state.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    state = new JTextField();
    state.setText(ft.getText());

    city = new JLabel("City");
    try {
      r = new FileReader(user + "/City.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    city1 = new JTextField();
    city1.setText(ft.getText());

    try {
      r = new FileReader(user + "/imagepath.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    ImageIcon io = new ImageIcon(ft.getText());
    icon.setIcon(io);

    next = new JButton("Update");
    next.setBackground(Color.white);
    // adding to container

    name1.setBounds(10, 10, 130, 25);
    name.setBounds(150, 10, 130, 25);

    last1.setBounds(10, 40, 130, 25);
    last.setBounds(150, 40, 130, 25);

    email1.setBounds(10, 70, 130, 25);
    email.setBounds(150, 70, 130, 25);

    pass.setBounds(290, 70, 130, 25);
    pwd.setBounds(390, 70, 130, 25);

    addimage.setBounds(350, 440, 100, 25);
    icon.setBounds(490, 410, 100, 100);

    date1.setBounds(10, 100, 130, 25);
    date.setBounds(120, 100, 40, 25);
    month.setBounds(180, 100, 130, 25);
    year.setBounds(320, 100, 130, 25);

    sx.setBounds(10, 140, 130, 25);
    gen.setBounds(150, 140, 130, 25);

    about.setBounds(10, 180, 130, 25);
    jsp.setBounds(150, 180, 250, 80);

    allow.setBounds(10, 260, 130, 25);
    c1.setBounds(150, 260, 130, 25);
    c2.setBounds(290, 260, 130, 25);

    c3.setBounds(150, 290, 130, 25);
    c4.setBounds(290, 290, 130, 25);

    uni.setBounds(10, 330, 130, 25);
    uni1.setBounds(150, 330, 130, 25);
    col.setBounds(10, 360, 130, 25);
    col1.setBounds(150, 360, 130, 25);

    con1.setBounds(10, 390, 130, 25);
    con.setBounds(150, 390, 130, 25);

    state1.setBounds(10, 430, 130, 25);
    state.setBounds(150, 430, 130, 25);

    city.setBounds(10, 460, 130, 25);
    city1.setBounds(150, 460, 130, 25);

    next.setBounds(50, 490, 130, 25);

    cp.add(name);
    cp.add(name1);
    cp.add(last);
    cp.add(last1);
    cp.add(email);
    cp.add(email1);
    cp.add(addimage);
    cp.add(icon);
    cp.add(date1);
    cp.add(date);
    cp.add(month);
    cp.add(year);
    cp.add(about);
    cp.add(jsp);
    cp.add(sx);
    cp.add(gen);
    cp.add(allow);
    cp.add(c1);
    cp.add(c2);
    cp.add(c3);
    cp.add(c4);
    cp.add(next);
    cp.add(uni);
    cp.add(uni1);
    cp.add(col);
    cp.add(col1);
    cp.add(con);
    cp.add(con1);
    cp.add(state1);
    cp.add(state);
    cp.add(city);
    cp.add(city1);
    cp.add(next);
    cp.add(pwd);
    cp.add(pass);

    addimage.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            filepath = name.getText();
            JFileChooser chooser = new JFileChooser();

            while (true) {
              int val = chooser.showOpenDialog(editprof.this);
              File f = chooser.getSelectedFile();
              String path = f.getPath();
              String name = f.getName();

              try {

                if (val == JFileChooser.CANCEL_OPTION || val == -1) {
                  break;
                } else {
                  image = new ImageIcon(path);
                  icon.setIcon(image);
                  w = new FileWriter(filepath + "/" + "imagePath.txt");
                  w.write(path + "");
                  w.close();
                  break;
                }
              } catch (Exception se) {
              }
            }
          }
        });

    date.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            int str = (Integer) e.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "date.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });

    month.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e1) {
            String str = (String) e1.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "month.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });
    con.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e2) {
            String str = (String) e2.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "contry.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });
    year.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e2) {
            int str = (Integer) e2.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "year.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });
    gen.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e3) {
            String str = (String) e3.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "gender.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });

    next.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent se) {
            try {

              w = new FileWriter(name.getText() + "/" + "First name.txt");
              w.write(name.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "last name.txt");
              w.write(last.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "email.txt");
              w.write(email.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "Collage.txt");
              w.write(col1.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "UniverSity.txt");
              w.write(uni1.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "state.txt");
              w.write(state.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "City.txt");
              w.write(city1.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "about.txt");
              w.write(main.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "password.txt");
              w.write(pwd.getText());
              w.close();

              profile e1 = new profile("My Profile", user1);
              e1.setVisible(true);
              e1.setLocation(00, 00);
              e1.setSize(800, 800);
              setVisible(false);
            } catch (Exception be) {
            }
          }
        });
  }
  public static Dimension getPreferredSize(AbstractButton b) {
    String style = (String) b.getClientProperty("Quaqua.Button.style");
    if (style == null) {
      style = "push";
    }
    if (style.equals("help")) {
      Icon helpIcon = UIManager.getIcon("Button.helpIcon");
      Insets insets = b.getInsets();

      return new Dimension(
          helpIcon.getIconWidth() + insets.left + insets.right,
          helpIcon.getIconHeight() + insets.top + insets.bottom);
    }
    if (b.getComponentCount() > 0) {
      return null;
    }

    int textIconGap = Methods.invokeGetter(b, "getIconTextGap", 4);
    Icon icon = (Icon) b.getIcon();
    String text = b.getText();

    Font font = b.getFont();
    FontMetrics fm = b.getFontMetrics(font);

    viewR.x = viewR.y = 0;
    viewR.width = Short.MAX_VALUE;
    viewR.height = Short.MAX_VALUE;
    iconR.x = iconR.y = iconR.width = iconR.height = 0;
    textR.x = textR.y = textR.width = textR.height = 0;

    SwingUtilities.layoutCompoundLabel(
        (JComponent) b,
        fm,
        text,
        icon,
        b.getVerticalAlignment(),
        b.getHorizontalAlignment(),
        b.getVerticalTextPosition(),
        b.getHorizontalTextPosition(),
        viewR,
        iconR,
        textR,
        (text == null ? 0 : textIconGap));

    /* The preferred size of the button is the size of
     * the text and icon rectangles plus the buttons insets.
     */

    Rectangle r = iconR.union(textR);

    // if (b.isBorderPainted()) {
    Insets insets = b.getInsets();
    r.width += insets.left + insets.right;
    r.height += insets.top + insets.bottom;
    // }
    if (!QuaquaUtilities.isSmallSizeVariant(b)
        && style.equals("push")
        && b.getIcon() == null
        && b.getText() != null) {
      r.width = Math.max(r.width, UIManager.getInt("Button.minimumWidth"));
    }
    return r.getSize();
  }
  /**
   * This method is not being used to paint menu item since 6.0 This code left for compatibility
   * only. Do not use or override it, this will not cause any visible effect.
   */
  public static void paintMenuItem(
      Graphics g,
      JComponent c,
      Icon checkIcon,
      Icon arrowIcon,
      Color background,
      Color foreground,
      int defaultTextIconGap) {

    JMenuItem b = (JMenuItem) c;
    ButtonModel model = b.getModel();

    Dimension size = b.getSize();
    Insets i = c.getInsets();

    Rectangle viewRect = new Rectangle(size);

    viewRect.x += i.left;
    viewRect.y += i.top;
    viewRect.width -= (i.right + viewRect.x);
    viewRect.height -= (i.bottom + viewRect.y);

    Rectangle iconRect = new Rectangle();
    Rectangle textRect = new Rectangle();
    Rectangle acceleratorRect = new Rectangle();
    Rectangle checkRect = new Rectangle();
    Rectangle arrowRect = new Rectangle();

    Font holdf = g.getFont();
    Font f = c.getFont();
    g.setFont(f);
    FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
    FontMetrics fmAccel =
        SwingUtilities2.getFontMetrics(c, g, UIManager.getFont("MenuItem.acceleratorFont"));

    if (c.isOpaque()) {
      if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
        g.setColor(background);
      } else {
        g.setColor(c.getBackground());
      }
      g.fillRect(0, 0, size.width, size.height);
    }

    // get Accelerator text
    KeyStroke accelerator = b.getAccelerator();
    String acceleratorText = "";
    if (accelerator != null) {
      int modifiers = accelerator.getModifiers();
      if (modifiers > 0) {
        acceleratorText = KeyEvent.getKeyModifiersText(modifiers);
        acceleratorText += "+";
      }
      acceleratorText += KeyEvent.getKeyText(accelerator.getKeyCode());
    }

    // layout the text and icon
    String text =
        layoutMenuItem(
            c,
            fm,
            b.getText(),
            fmAccel,
            acceleratorText,
            b.getIcon(),
            checkIcon,
            arrowIcon,
            b.getVerticalAlignment(),
            b.getHorizontalAlignment(),
            b.getVerticalTextPosition(),
            b.getHorizontalTextPosition(),
            viewRect,
            iconRect,
            textRect,
            acceleratorRect,
            checkRect,
            arrowRect,
            b.getText() == null ? 0 : defaultTextIconGap,
            defaultTextIconGap);

    // Paint the Check
    Color holdc = g.getColor();
    if (checkIcon != null) {
      if (model.isArmed() || (c instanceof JMenu && model.isSelected())) g.setColor(foreground);
      checkIcon.paintIcon(c, g, checkRect.x, checkRect.y);
      g.setColor(holdc);
    }

    // Paint the Icon
    if (b.getIcon() != null) {
      Icon icon;
      if (!model.isEnabled()) {
        icon = (Icon) b.getDisabledIcon();
      } else if (model.isPressed() && model.isArmed()) {
        icon = (Icon) b.getPressedIcon();
        if (icon == null) {
          // Use default icon
          icon = (Icon) b.getIcon();
        }
      } else {
        icon = (Icon) b.getIcon();
      }

      if (icon != null) {
        icon.paintIcon(c, g, iconRect.x, iconRect.y);
      }
    }

    // Draw the Text
    if (text != null && !text.equals("")) {
      // Once BasicHTML becomes public, use BasicHTML.propertyKey
      // instead of the hardcoded string below!
      View v = (View) c.getClientProperty("html");
      if (v != null) {
        v.paint(g, textRect);
      } else {
        int mnemIndex = b.getDisplayedMnemonicIndex();

        if (!model.isEnabled()) {
          // *** paint the text disabled
          g.setColor(b.getBackground().brighter());
          SwingUtilities2.drawStringUnderlineCharAt(
              b, g, text, mnemIndex, textRect.x, textRect.y + fmAccel.getAscent());
          g.setColor(b.getBackground().darker());
          SwingUtilities2.drawStringUnderlineCharAt(
              b, g, text, mnemIndex, textRect.x - 1, textRect.y + fmAccel.getAscent() - 1);

        } else {
          // *** paint the text normally
          if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
            g.setColor(foreground);
          } else {
            g.setColor(b.getForeground());
          }
          SwingUtilities2.drawStringUnderlineCharAt(
              b, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
        }
      }
    }

    // Draw the Accelerator Text
    if (acceleratorText != null && !acceleratorText.equals("")) {

      // Get the maxAccWidth from the parent to calculate the offset.
      int accOffset = 0;
      Container parent = b.getParent();
      if (parent != null && parent instanceof JComponent) {
        JComponent p = (JComponent) parent;
        Integer maxValueInt = (Integer) p.getClientProperty(MotifGraphicsUtils.MAX_ACC_WIDTH);
        int maxValue = maxValueInt != null ? maxValueInt.intValue() : acceleratorRect.width;

        // Calculate the offset, with which the accelerator texts will be drawn with.
        accOffset = maxValue - acceleratorRect.width;
      }

      g.setFont(UIManager.getFont("MenuItem.acceleratorFont"));
      if (!model.isEnabled()) {
        // *** paint the acceleratorText disabled
        g.setColor(b.getBackground().brighter());
        SwingUtilities2.drawString(
            c,
            g,
            acceleratorText,
            acceleratorRect.x - accOffset,
            acceleratorRect.y + fm.getAscent());
        g.setColor(b.getBackground().darker());
        SwingUtilities2.drawString(
            c,
            g,
            acceleratorText,
            acceleratorRect.x - accOffset - 1,
            acceleratorRect.y + fm.getAscent() - 1);
      } else {
        // *** paint the acceleratorText normally
        if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
          g.setColor(foreground);
        } else {
          g.setColor(b.getForeground());
        }
        SwingUtilities2.drawString(
            c,
            g,
            acceleratorText,
            acceleratorRect.x - accOffset,
            acceleratorRect.y + fmAccel.getAscent());
      }
    }

    // Paint the Arrow
    if (arrowIcon != null) {
      if (model.isArmed() || (c instanceof JMenu && model.isSelected())) g.setColor(foreground);
      if (!(b.getParent() instanceof JMenuBar)) arrowIcon.paintIcon(c, g, arrowRect.x, arrowRect.y);
    }

    g.setColor(holdc);
    g.setFont(holdf);
  }
 protected void installDefaults() {
   setFont(UIManager.getFont("InternalFrame.titleFont"));
   setPreferredSize(new Dimension(100, BUTTON_SIZE));
 }
  Library() {
    super("Library Management");
    frame = this;
    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception de) {
    }

    cp = getContentPane();
    cp.setLayout(null);

    // Adding TextArea in Panel
    jp1 = new JPanel(null, true);
    // t1=new
    // JTextField("|Name    "+"\t\t"+"  |Author"+"\t\t "+" |Publication   "+"\t"+"|Issue
    // "+"\t"+"|Return    "+"\t"+"|  Cutm. Id");
    // t1.setEditable(false);
    // t1.setBounds(0,0,600,20);
    // jp1.add(t1);

    MenuBar mb = new MenuBar();
    setMenuBar(mb);
    Menu menu2 = new Menu("Skins");
    MenuItem item4 = new MenuItem("Defualt Skin");
    MenuItem item5 = new MenuItem("Metal Skin");
    MenuItem item6 = new MenuItem("Modified Skin");
    // item5.setSelected(true);
    menu2.add(item4);
    menu2.add(item5);
    menu2.add(item6);
    mb.add(menu2);

    Menu menu21 = new Menu("Backup");
    MenuItem item61 = new MenuItem("Create Database Backup");
    menu21.add(item61);
    mb.add(menu21);

    // Menu menu1=new Menu("About");
    // MenuItem item1=new MenuItem("Help ?");
    // MenuItem item2=new MenuItem("Support ?");
    // MenuItem item3=new MenuItem("About Us ?");
    // menu1.add(item1);menu1.add(item2);menu1.add(item3);
    // mb.add(menu1);

    Menu menu212 = new Menu("Exit");
    MenuItem item612 = new MenuItem("Exit Form Library");
    menu212.add(item612);
    mb.add(menu212);

    int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;

    Color re = new Color(122, 145, 201);

    mo1 = new DefaultListModel();
    list1 = new JList(mo1);
    ml1 = new JLabel("    Book's Name");
    ml1.setForeground(Color.red);
    ml1.setBounds(15, 0, 154, 20);
    list1.setBounds(15, 20, 154, 500);
    list1.setToolTipText("NAme of Book's Present in Database");
    jp1.add(ml1);
    jp1.add(list1);

    mo2 = new DefaultListModel();
    list2 = new JList(mo2);
    ml2 = new JLabel("   Author");
    ml2.setForeground(re);
    ml2.setBounds(140 + 30, 0, 99, 20);
    list2.setToolTipText("Name of Book Author's Present in Database");
    list2.setBounds(140 + 30, 20, 99, 900);
    jp1.add(ml2);
    jp1.add(list2);

    mo3 = new DefaultListModel();
    list3 = new JList(mo3);
    ml3 = new JLabel("   Publication");
    ml3.setForeground(re);
    ml3.setBounds(240 + 30, 0, 99, 20);
    list3.setToolTipText("Name of Book's Publication Present in Database");
    list3.setBounds(240 + 30, 20, 99, 500);
    jp1.add(ml3);
    jp1.add(list3);

    mo4 = new DefaultListModel();
    list4 = new JList(mo4);
    ml4 = new JLabel("  Issue Date");
    ml4.setForeground(re);
    ml4.setBounds(340 + 30, 0, 70, 20);
    list4.setToolTipText("Date of Issue Present in Database");
    list4.setBounds(340 + 30, 20, 70, 500);
    jp1.add(ml4);
    jp1.add(list4);

    mo5 = new DefaultListModel();
    list5 = new JList(mo5);
    ml5 = new JLabel("   Return Date");
    ml5.setForeground(re);
    ml5.setBounds(411 + 30, 0, 70, 20);
    list5.setToolTipText("Date of Return Present in Database");
    list5.setBounds(411 + 30, 20, 70, 500);
    jp1.add(ml5);
    jp1.add(list5);

    mo6 = new DefaultListModel();
    list6 = new JList(mo6);
    ml6 = new JLabel("   Cust. ID");
    ml6.setForeground(re);
    ml6.setBounds(482 + 30, 0, 60, 20);
    list6.setToolTipText("ID of customer that purchase the book last time ");
    list6.setBounds(482 + 30, 20, 60, 500);
    jp1.add(ml6);
    jp1.add(list6);

    // a1=new JTextArea();
    // a1.setText("|Name    "+"\t\t\t"+"  |Author"+"\t\t\t"+" |Publication   "+"\t\t"+"|Issue
    // "+"\t\t"+"|Return    "+"\t\t"+"|  Cutm. Id");
    // a1.setEditable(false);
    // JScrollPane scroll=new JScrollPane(a1,v,h);
    // scroll.setBounds(0,20,600,578);
    // jp1.add(scroll);

    for (int x = 1; x < 100; x++) {
      sr = new JLabel(x + "\n");
      sr.setForeground(re);
      sr.setBounds(0, 20, 10, 500);
      jp1.add(sr);
    }

    // jp1.setBackground(Color.black);
    JScrollPane nm = new JScrollPane(jp1, v, h);
    nm.setBounds(10, 20, 600, 500);
    cp.add(nm);

    jp2 = new JPanel(null, true);

    b1 = new JButton("Add Book");
    b1.setBounds(10, 10, 120, 25);
    jp2.add(b1);

    b2 = new JButton("Delete Book");
    b2.setBounds(10, 45, 120, 25);
    jp2.add(b2);

    b3 = new JButton("View Book Details");
    b3.setBounds(10, 80, 120, 25);
    jp2.add(b3);

    b4 = new JButton("View All Book's");
    b4.setBounds(10, 115, 120, 25);
    jp2.add(b4);

    Color r = new Color(122, 145, 201);
    jp2.setBackground(r);
    jp2.setBounds(630, 20, 160, 145);
    cp.add(jp2);

    jp3 = new JPanel(null, true);

    t1 = new JTextField();
    t1.setBounds(10, 10, 120, 20);
    jp3.add(t1);
    t1.setToolTipText("Find The Book By Book Name. It is Advaced Search System");

    b5 = new JButton("Search Book Name");
    b5.setBounds(05, 35, 130, 20);
    jp3.add(b5);
    // b5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,Event.CTRL_MASK));
    b5.setMnemonic(KeyEvent.VK_N);

    JLabel lk = new JLabel("__________________________________");
    lk.setForeground(Color.black);
    lk.setBounds(0, 50, 160, 6);
    jp3.add(lk);

    t14 = new JTextField();
    t14.setBounds(10, 60, 120, 20);
    jp3.add(t14);
    t14.setToolTipText("Find The Book By Author Name. It is Advaced Search System");

    b10 = new JButton("Search Author");
    b10.setBounds(05, 85, 130, 20);
    jp3.add(b10);

    // b10.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_a,Event.CTRL_MASK));
    b10.setMnemonic(KeyEvent.VK_N);

    Color r1 = new Color(122, 145, 201);
    jp3.setBackground(r1);
    jp3.setBounds(630, 180, 160, 115);
    cp.add(jp3);

    jp4 = new JPanel(null, true);

    b15 = new JButton("Add Customer");
    b15.setBounds(10, 05, 120, 25);
    jp4.add(b15);

    b6 = new JButton("View all Cotumers");
    b6.setBounds(10, 35, 120, 25);
    jp4.add(b6);

    t2 = new JTextField();
    t2.setBounds(10, 65, 120, 20);
    t2.setToolTipText("Find The Customer Information. It is Advaced Search System");
    jp4.add(t2);

    b7 = new JButton("Search");
    b7.setBounds(05, 90, 130, 20);
    jp4.add(b7);

    b8 = new JButton("Delete Costumer");
    b8.setBounds(10, 115, 120, 25);
    jp4.add(b8);

    b9 = new JButton("View Cust. Details");
    b9.setBounds(10, 150, 120, 25);
    jp4.add(b9);

    Color r3 = new Color(122, 145, 201);
    jp4.setBackground(r3);
    jp4.setBounds(630, 305, 160, 180);
    cp.add(jp4);

    b_no = new JLabel();
    b_no.setForeground(Color.red);
    b_no.setBounds(150, 0, 150, 20);
    cp.add(b_no);

    progress1 = new JProgressBar();
    progress1.setBackground(re);
    progress1.setBounds(630, 490, 150, 25);
    cp.add(progress1);

    try {
      rd1 = new FileReader("Database/pointer.mmm");
      read1 = new JTextField();
      read1.read(rd1, null);
      int count = Integer.parseInt(read1.getText());
      int total = count - 1;
      int blk = 0;
      rd1.close();

      for (int i = 1; i < count; i++) {
        rd1 = new FileReader("Database/" + i + ".name");
        read1 = new JTextField();
        read1.read(rd1, null);
        if (!read1.getText().equals("")) {
          blk++;
          b_no.setText("Total Books = " + blk + " (Book's)");
          mo1.addElement(read1.getText() + "");
          rd1.close();

          int per = i * 100 / total;
          progress1.setValue(per);

          rd1 = new FileReader("Database/" + i + ".author");
          read1 = new JTextField();
          read1.read(rd1, null);
          mo2.addElement(read1.getText() + "");
          rd1.close();

          rd1 = new FileReader("Database/" + i + ".publication");
          read1 = new JTextField();
          read1.read(rd1, null);
          mo3.addElement(read1.getText() + "");
          rd1.close();

          rd1 = new FileReader("Database/" + i + ".issue");
          read1 = new JTextField();
          read1.read(rd1, null);
          if (!read1.getText().equals("")) {
            mo4.addElement(read1.getText() + "");
          } else {
            mo4.addElement(read1.getText() + "   -");
          }
          rd1.close();

          rd1 = new FileReader("Database/" + i + ".return");
          read1 = new JTextField();
          read1.read(rd1, null);
          mo5.addElement(read1.getText() + "");
          rd1.close();

          rd1 = new FileReader("Database/" + i + ".id");
          read1 = new JTextField();
          read1.read(rd1, null);
          mo6.addElement(read1.getText() + "");
          rd1.close();
        }
      }
    } catch (Exception der) {
      a1.setText("Error Occurs: \n" + der);
    }

    // Source code for searching the book's from Database
    // it search book by name of book,author,publication
    // it work when you don't know about any thing than press any
    // keyword to find book/
    // eg: if you have book name that publish by that publication which
    // starts from "c"
    // then you press only "c" in search it show you all Books that start
    // with "c" ,Author "c" and publication that start "c" .

    // Warning:
    // Don't Modify the code without knowledge of full source code
    // Author : Pravin Rane

    b5.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              int bs1 = 0;
              progress1.setValue(0);
              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              ml1.setText("Book Name");
              ml2.setText("Author");
              ml3.setText("Publication");
              ml4.setText("Issue Date");
              ml5.setText("Return Date");
              ml6.setText("Cust. ID.");

              if (!t1.getText().equals("")) {
                rd1 = new FileReader("Database/pointer.mmm");
                read1 = new JTextField();
                read1.read(rd1, null);
                int no = Integer.parseInt(read1.getText());
                rd1.close();

                int len = t1.getText().length();
                for (int k = 0; k < len; k++) {
                  char ch = t1.getText().charAt(k);
                  stra1 = stra1 + ch;
                  // System.out.println(stra1+"");
                }

                for (int v = 1; v < no; v++) {
                  name11 = "";
                  author11 = "";
                  publication11 = "";
                  progress1.setMaximum(no);

                  int per = v * 100 / no;
                  progress1.updateUI();
                  progress1.setValue(per);

                  FileReader re1 = new FileReader("Database/" + v + ".name");
                  JTextField jt1 = new JTextField();
                  jt1.read(re1, null);
                  String name = jt1.getText();
                  re1.close();

                  FileReader re2 = new FileReader("Database/" + v + ".author");
                  JTextField jt2 = new JTextField();
                  jt2.read(re2, null);
                  String author = jt2.getText();
                  re2.close();

                  FileReader re3 = new FileReader("Database/" + v + ".publication");
                  JTextField jt3 = new JTextField();
                  jt3.read(re3, null);
                  String publication = jt3.getText();
                  re3.close();
                  find = v;

                  try {
                    for (int z = 0; z < len; z++) {

                      name11 = name11 + name.charAt(z);

                      // author11=author11+author.charAt(z);
                      // System.out.println(author11+"");
                      publication11 = publication11 + publication.charAt(z);
                      if (z == (len - 1)) {
                        // System.out.println(name11+"");
                        // System.out.println(publication11+"");
                      }
                    }

                  } catch (Exception def) {
                  }

                  if (name.toLowerCase().equals(t1.getText())
                      || name.toUpperCase().equals(t1.getText())
                      || author.toLowerCase().equals(t1.getText())
                      || author.toUpperCase().equals(t1.getText())
                      || publication.toLowerCase().equals(t1.getText())
                      || publication.toUpperCase().equals(t1.getText())) {
                    bs1++;
                    rd1 = new FileReader("Database/" + find + ".name");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo1.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo2.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo3.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo4.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo5.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo6.addElement(read1.getText() + "");
                    rd1.close();

                  } else if (publication11.toLowerCase().equals(t1.getText())
                      || author11.toLowerCase().equals(t1.getText())
                      || name11.toLowerCase().equals(t1.getText())
                      || publication11.toUpperCase().equals(t1.getText())
                      || author11.toUpperCase().equals(t1.getText())
                      || name11.toUpperCase().equals(t1.getText())) {
                    bs1++;

                    rd1 = new FileReader("Database/" + find + ".name");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo1.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo2.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo3.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo4.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo5.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo6.addElement(read1.getText() + "");
                    rd1.close();
                  }

                  b_no.setText("Total Book Found =" + bs1 + " (Book's)");
                }

              } else {
                progress1.setValue(0);
                JOptionPane.showMessageDialog(
                    (Component) null,
                    "Please Enter the Book Name or Publcation",
                    "Library Management(Pravin Rane)",
                    JOptionPane.OK_OPTION);
                b_no.setText("User Input Error!");
              }

            } catch (Exception der) {
              System.out.println("Error:" + der);
            }
          }
        });

    b10.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              int bs2 = 0;
              progress1.setValue(0);
              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              ml1.setText("Book Name");
              ml2.setText("Author");
              ml3.setText("Publication");
              ml4.setText("Issue Date");
              ml5.setText("Return Date");
              ml6.setText("Cust. ID.");

              if (!t14.getText().equals("")) {

                rd1 = new FileReader("Database/pointer.mmm");
                read1 = new JTextField();
                read1.read(rd1, null);
                int no = Integer.parseInt(read1.getText());
                rd1.close();

                int len = t14.getText().length();
                for (int k = 0; k < len; k++) {
                  char ch = t14.getText().charAt(k);
                  stra1 = stra1 + ch;
                  // System.out.println(stra1+"");
                }

                for (int v = 1; v < no; v++) {
                  name11 = "";
                  author11 = "";
                  publication11 = "";
                  progress1.setMaximum(no);

                  int per = v * 100 / no;
                  progress1.updateUI();
                  progress1.setValue(per);

                  FileReader re1 = new FileReader("Database/" + v + ".name");
                  JTextField jt1 = new JTextField();
                  jt1.read(re1, null);
                  String name = jt1.getText();
                  re1.close();

                  FileReader re2 = new FileReader("Database/" + v + ".author");
                  JTextField jt2 = new JTextField();
                  jt2.read(re2, null);
                  String author = jt2.getText();
                  re2.close();

                  FileReader re3 = new FileReader("Database/" + v + ".publication");
                  JTextField jt3 = new JTextField();
                  jt3.read(re3, null);
                  String publication = jt3.getText();
                  re3.close();
                  find = v;

                  try {
                    for (int z = 0; z < len; z++) {

                      // name11=name11+name.charAt(z);

                      author11 = author11 + author.charAt(z);
                      // System.out.println(author11+"");
                      // publication11=publication11+publication.charAt(z);
                      if (z == (len - 1)) {
                        // System.out.println(name11+"");
                        // System.out.println(publication11+"");
                      }
                    }

                  } catch (Exception def) {
                  }

                  if (author.toLowerCase().equals(t14.getText())
                      || author.toUpperCase().equals(t14.getText())) {
                    bs2++;
                    rd1 = new FileReader("Database/" + find + ".name");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo1.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo2.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo3.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo4.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo5.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo6.addElement(read1.getText() + "");
                    rd1.close();

                  } else if (author11.toLowerCase().equals(t14.getText())
                      || author11.toUpperCase().equals(t14.getText())) {
                    bs2++;

                    rd1 = new FileReader("Database/" + find + ".name");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo1.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo2.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo3.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo4.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo5.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo6.addElement(read1.getText() + "");
                    rd1.close();
                  }

                  b_no.setText("Total Book Found =" + bs2 + " (Book's)");
                }
              } else {
                progress1.setValue(0);
                b_no.setText("User Input Error!");
                JOptionPane.showMessageDialog(
                    (Component) null,
                    "Please Enter the Book Author name",
                    "Library Management(Pravin Rane)",
                    JOptionPane.OK_OPTION);
              }
            } catch (Exception der) {
              System.out.println("Error:" + der);
            }
          }
        });

    // End of Serching Book
    // Author : Pravin Rane

    // it use to aplly the skins to UserInteface
    // there are three skins Default which is Windows Skin
    // Metal skin and modified skin.
    // apply it as oer ur requirment.
    // Author : Pravin H. Rane

    item4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              SwingUtilities.updateComponentTreeUI(frame);
            } catch (Exception dert) {
              System.out.println(dert);
            }
          }
        });

    item5.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
              SwingUtilities.updateComponentTreeUI(frame);
            } catch (Exception dert) {
              System.out.println(dert);
            }
          }
        });

    item6.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
              SwingUtilities.updateComponentTreeUI(frame);
            } catch (Exception dert) {
              System.out.println(dert);
            }
          }
        });

    item61.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              Date d = new Date();
              int my1 = d.getDate();
              int my2 = d.getMonth();

              FileDialog fd =
                  new FileDialog(frame, "Save Database Backup File (Library Management )");
              fd.setMode(FileDialog.SAVE);
              fd.setFile("Database" + my1 + "." + my2 + ".rar");
              fd.setVisible(true);
              String dir = fd.getDirectory();
              String path = fd.getFile();

              String command = "jar cvf Database1.rar Database/*.*";
              Runtime r = Runtime.getRuntime();
              r.exec(command);

              String command2 = "jar cvf  Database2.rar Cust_Details/*.*";
              Runtime r2 = Runtime.getRuntime();
              r2.exec(command2);

              try {
                Thread.sleep(1000);
              } catch (Exception fr) {
              }
              String command3 = "jar cvf " + dir + path + " Database1.rar  Database2.rar";
              Runtime r3 = Runtime.getRuntime();
              r3.exec(command3);

              System.out.println("Database Backup Sucessfully!");

            } catch (Exception dert) {
              System.out.println(dert);
            }
          }
        });

    item612.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });

    // End Of Applyinf Skin to UInterface

    // This Button show the details of Book's
    // that specified when the book is adding in the database
    // you can modify the details of book.
    // Author : Pravin H. Rane

    b3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              // view v=new view(String str,string info,boolean val);

            } catch (Exception der) {
            }
          }
        });

    // End of book details

    b15.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Addcust ad = new Addcust();
            ad.setVisible(true);
            ad.setSize(380, 400);
            ad.setLocation(80, 140);
          }
        });

    // it show all book's available in database
    // it dosn't sort book by sequensely
    // you can modify the code for sorting the book as per your requirement
    // Author : Pravin

    b1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            addBook a = new addBook();
          }
        });

    b4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            try {
              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              ml1.setText("Book Name");
              ml2.setText("Author");
              ml3.setText("Publication");
              ml4.setText("Issue Date");
              ml5.setText("Return Date");
              ml6.setText("Cust. ID.");
              int za = 0;

              rd1 = new FileReader("Database/pointer.mmm");
              read1 = new JTextField();
              read1.read(rd1, null);
              int count = Integer.parseInt(read1.getText());
              int total = count - 1;

              rd1.close();

              for (int i = 1; i < count; i++) {

                rd1 = new FileReader("Database/" + i + ".name");
                read1 = new JTextField();
                read1.read(rd1, null);
                if (!read1.getText().equals("")) {
                  za++;
                  b_no.setText("Total Books = " + za + " (Book's)");
                  mo1.addElement(read1.getText() + "");
                  rd1.close();

                  progress1.setMaximum(total);
                  int per = i * 100 / total;
                  progress1.setValue(per);

                  rd1 = new FileReader("Database/" + i + ".author");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  mo2.addElement(read1.getText() + "");
                  rd1.close();

                  rd1 = new FileReader("Database/" + i + ".publication");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  mo3.addElement(read1.getText() + "");
                  rd1.close();

                  rd1 = new FileReader("Database/" + i + ".issue");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  if (!read1.getText().equals("")) {
                    mo4.addElement(read1.getText() + "");
                  } else {
                    mo4.addElement(read1.getText() + "   _");
                  }
                  rd1.close();

                  rd1 = new FileReader("Database/" + i + ".return");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  mo5.addElement(read1.getText() + "");
                  rd1.close();

                  rd1 = new FileReader("Database/" + i + ".id");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  mo6.addElement(read1.getText() + "");
                  rd1.close();

                  progress1.setValue(100);
                }
              }
            } catch (Exception der) {
              a1.setText("Error Occurs: \n" + der);
            }
          }
        });
    // End of View all Book's

    // This source code is used to show information of all customers
    // Author :Pravin Rane

    b6.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {

              ml1.setText("Cust. ID");
              ml2.setText("Cust. Name");
              ml3.setText("Registration Date");
              ml4.setText("Book Name");
              ml5.setText("Purchase Date");
              ml6.setText("Return Date");

              int z12 = 0;

              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              rd2 = new FileReader("Cust_Details/pointer.mmm");
              jt2 = new JTextField();
              jt2.read(rd2, null);
              rd2.close();

              int no = Integer.parseInt(jt2.getText());
              int tt = no - 1;
              // b_no.setText("Total Customer's :"+tt );

              for (int v = 1; v < no; v++) {

                rd2 = new FileReader("Cust_Details/Cus" + v + ".id");
                jt2 = new JTextField();
                jt2.read(rd2, null);
                if (!jt2.getText().equals("")) {
                  z12++;
                  b_no.setText("Total Customers = " + z12);
                  mo1.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".name");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo2.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".date");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo3.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".bname");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo4.addElement(jt2.getText() + "");
                  } else {
                    mo4.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo5.addElement(jt2.getText() + "");
                  } else {
                    mo5.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".return");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo6.addElement(jt2.getText() + "");
                  } else {
                    mo6.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();
                }
              }

            } catch (Exception ser) {
              System.out.println(ser);
            }
          }
        });
    // End of showing customer's Info.

    b9.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {

              int ad = list1.getSelectedIndex();
              String str = (String) mo1.getElementAt(ad);

              System.out.println(str);

              cust_detail d = new cust_detail(str);
              d.setVisible(true);
              d.setSize(300, 550);
              d.setLocation(100, 0);
            } catch (Exception fr) {
              JOptionPane.showMessageDialog(
                  (Component) null,
                  "Please Select Customer ID from List of Cust. ID. ",
                  "Library Management(Pravin Rane)",
                  JOptionPane.OK_OPTION);
              try {
                ml1.setText("Cust. ID");
                ml2.setText("Cust. Name");
                ml3.setText("Registration Date");
                ml4.setText("Book Name");
                ml5.setText("Purchase Date");
                ml6.setText("Return Date");

                mo1.removeAllElements();
                mo2.removeAllElements();
                mo3.removeAllElements();
                mo4.removeAllElements();
                mo5.removeAllElements();
                mo6.removeAllElements();

                rd2 = new FileReader("Cust_Details/pointer.mmm");
                jt2 = new JTextField();
                jt2.read(rd2, null);
                rd2.close();
                int no = Integer.parseInt(jt2.getText());

                for (int v = 1; v < no; v++) {
                  rd2 = new FileReader("Cust_Details/Cus" + v + ".id");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo1.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".name");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo2.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".date");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo3.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".bname");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo4.addElement(jt2.getText() + "");
                  } else {
                    mo4.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo5.addElement(jt2.getText() + "");
                  } else {
                    mo5.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".return");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo6.addElement(jt2.getText() + "");
                  } else {
                    mo6.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();
                }
              } catch (Exception fg) {
              }
            }
          }
        });

    b7.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String mysearchid = t2.getText();
            try {
              ml1.setText("Cust. ID");
              ml2.setText("Cust. Name");
              ml3.setText("Registration Date");
              ml4.setText("Book Name");
              ml5.setText("Purchase Date");
              ml6.setText("Return Date");

              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              if (!t2.getText().equals("")) {
                rd2 = new FileReader("Cust_Details/pointer.mmm");
                jt2 = new JTextField();
                jt2.read(rd2, null);
                rd2.close();
                int no = Integer.parseInt(jt2.getText());

                int len3 = t2.getText().length();

                for (int v = 1; v < no; v++) {
                  name22 = "";
                  int lg = 0;
                  rd2 = new FileReader("Cust_Details/Cus" + v + ".id");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  // mo1.addElement(jt2.getText()+"");
                  String s1 = jt2.getText();
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".name");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  // mo2.addElement(jt2.getText()+"");
                  String s2 = jt2.getText();
                  rd2.close();

                  for (int z = 0; z < len3; z++) {
                    name22 = name22 + s2.charAt(z);
                  }

                  if (s1.toLowerCase().equals(mysearchid)
                      || s1.toUpperCase().equals(mysearchid)
                      || s2.toLowerCase().equals(mysearchid)
                      || s2.toUpperCase().equals(mysearchid)
                      || name22.toUpperCase().equals(mysearchid)
                      || name22.toLowerCase().equals(mysearchid)) {
                    lg++;
                    b_no.setText("Customer Found :" + lg);
                    rd2 = new FileReader("Cust_Details/Cus" + v + ".id");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    mo1.addElement(jt2.getText() + "");
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".name");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    mo2.addElement(jt2.getText() + "");
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".date");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    mo3.addElement(jt2.getText() + "");
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".bname");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    if (!jt2.getText().equals("")) {
                      mo4.addElement(jt2.getText() + "");
                    } else {
                      mo4.addElement(jt2.getText() + "   _");
                    }
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    if (!jt2.getText().equals("")) {
                      mo5.addElement(jt2.getText() + "");
                    } else {
                      mo5.addElement(jt2.getText() + "   _");
                    }
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".return");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    if (!jt2.getText().equals("")) {
                      mo6.addElement(jt2.getText() + "");
                    } else {
                      mo6.addElement(jt2.getText() + "   _");
                    }
                    rd2.close();
                  }
                }
              } else {
                progress1.setValue(0);
                b_no.setText("User Input Error!");
                JOptionPane.showMessageDialog(
                    (Component) null,
                    "Please Enter Customer Id or Name",
                    "Library Management(Pravin Rane)",
                    JOptionPane.OK_OPTION);
              }

            } catch (Exception de) {
            }
          }
        });

    b2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int ad = list1.getSelectedIndex();
            String str99 = (String) mo1.getElementAt(ad);
            try {

              rd2 = new FileReader("Database/pointer.mmm");
              jt2 = new JTextField();
              jt2.read(rd2, null);
              rd2.close();
              int nom = Integer.parseInt(jt2.getText());

              for (int count2 = 1; count2 < nom; count2++) {
                rd1 = new FileReader("Database/" + count2 + ".name");
                read1 = new JTextField();
                read1.read(rd1, null);
                rd1.close();

                if (read1.getText().equals(str99)) {
                  wr1 = new FileWriter("Database/" + count2 + ".name");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".author");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".publication");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".issue");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".return");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".detail");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".id");
                  wr1.write("");
                  wr1.close();
                  try {
                    Library lbc = new Library();
                    setVisible(false);
                    lbc.setVisible(true);
                    lbc.setSize(800, 600);
                  } catch (Exception de) {
                  }
                }
              }

            } catch (Exception fr) {
              System.out.println(fr);
            }
          }
        });

    b3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              int ad = list1.getSelectedIndex();
              String str34 = (String) mo1.getElementAt(ad);

              jf55 = new JFrame("Book Details");
              jf55.setVisible(true);
              jf55.setLayout(null);
              jf55.setLocation(160, 180);

              JTextArea ak47 = new JTextArea();
              ak47.setEditable(false);
              ak47.setText(
                  "Book Details" + "\n" + "**************************************************");
              ak47.setBounds(10, 10, 250, 250);
              jf55.add(ak47);

              Button b1 = new Button("Ok");
              b1.setBounds(80, 270, 100, 25);
              jf55.add(b1);
              b1.addActionListener(
                  new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                      jf55.setVisible(false);
                    }
                  });

              jf55.setSize(285, 335);

              rd2 = new FileReader("Database/pointer.mmm");
              jt2 = new JTextField();
              jt2.read(rd2, null);
              rd2.close();
              int nov = Integer.parseInt(jt2.getText());

              for (int i = 1; i < nov; i++) {
                rd1 = new FileReader("Database/" + i + ".name");
                read1 = new JTextField();
                read1.read(rd1, null);
                String hj = read1.getText();
                rd1.close();

                if (hj.equals(str34)) {
                  rd1 = new FileReader("Database/" + i + ".name");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  if (!read1.getText().equals("")) {
                    ak47.setText(ak47.getText() + "\n" + "Book Name :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    ak47.setText(ak47.getText() + "\n" + "Book Author :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    ak47.setText(ak47.getText() + "\n" + "Book Publication :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    if (!read1.getText().equals("")) {
                      ak47.setText(ak47.getText() + "\n" + "Issue Date :" + read1.getText());
                    } else {
                      ak47.setText(ak47.getText() + "\n" + "Issue Date : None");
                    }
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    ak47.setText(ak47.getText() + "\n" + "Return Date :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    ak47.setText(ak47.getText() + "\n" + "Cust. Id :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".detail");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    if (!read1.getText().equals("")) {
                      ak47.setText(ak47.getText() + "\n" + "Other Details : \n" + read1.getText());
                    } else {
                      ak47.setText(ak47.getText() + "\n" + "Other Details : Not Found");
                    }
                    rd1.close();
                  }
                }
              }

            } catch (Exception de) {
              JOptionPane.showMessageDialog(
                  (Component) null,
                  "Please Select Book Name from List",
                  "Library Management(Pravin Rane)",
                  JOptionPane.OK_OPTION);
            }
          }
        });
  }
Exemple #23
0
 protected Color getDisabledTextColor() {
   disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText");
   return disabledTextColor;
 }
Exemple #24
0
 // ********************************
 //         Default Accessors
 // ********************************
 protected Color getSelectColor() {
   selectColor = UIManager.getColor(getPropertyPrefix() + "select");
   return selectColor;
 }
Exemple #25
0
 protected Color getFocusColor() {
   focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
   return focusColor;
 }
 /** Adds the ui class to UIDefaults. */
 static {
   UIManager.getDefaults().put(UIClassID, BasicButtonUI.class.getName());
 }