private void initCalPanel() {
   int year = cal.get(Calendar.YEAR);
   int month = cal.get(Calendar.MONTH);
   int maxDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
   int mark = 1;
   int firstDayOfWeek = new GregorianCalendar(year, month, 1).get(Calendar.DAY_OF_WEEK);
   panel.setLayout(null);
   panel.setBackground(Color.WHITE);
   String[] week = {"日", "一", "二", "三", "四", "五", "六"};
   for (int i = 0; i < 7; i++) {
     addLabelOnPanel(i, week[i], false);
   }
   for (int i = 1; i < firstDayOfWeek; i++) {
     startPoint_x += 40;
   }
   for (int i = firstDayOfWeek - 1; i < 7; i++) {
     addLabelOnPanel(i, "" + mark++, true);
   }
   while (mark <= maxDay) {
     for (int i = 0; i < 7; i++) {
       addLabelOnPanel(i, "" + mark++, true);
       if (mark >= maxDay) break;
     }
   }
 }
예제 #2
0
파일: SetMap.java 프로젝트: kkmehra/SE
  public void newframe() {
    JFrame frame = new JFrame("Cab Service ");
    frame.setSize(800, 600);

    frame.setVisible(true);
    // frame.setBackground(Color.CYAN);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton jb = new JButton("Set Name of Places ");
    jb.setBounds(100, 100, 20, 50);

    JPanel jp = new JPanel();
    jp.setBackground(Color.gray);
    jp.add(jb);
    frame.add(jp);
    JPanel jp1 = new JPanel();
    jp1.setBackground(Color.gray);
    frame.add(jp1);

    frame.add(jp);
    jb.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            try {
              CreateFrame();

            } catch (IOException ex) {
              Logger.getLogger(SetMap.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        });
  }
예제 #3
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
 public void kosmetika() {
   setTitle("Automobilių sąrašų demo - KTU IF 2010");
   panAutoSąr.setBorder(new TitledBorder("Visų automobilių ir atrinktų automobilių sąrašai"));
   panAutoSąr.setBackground(Color.yellow);
   panDuomenys.setBorder(new TitledBorder("Automobilių duomenys"));
   panDuomenys.setBackground(Color.lightGray);
   panAsmensDuo.setBackground(Color.green);
   panRez.setBackground(Color.gray);
   panMygt.setBackground(Color.magenta);
 }
 public void kosmetika() {
   setTitle("Knygų sąrašų demo - KTU IF 2012");
   panKnygųSar.setBorder(new TitledBorder("Visų knygų ir atrinktų knygų sąrašai"));
   panKnygųSar.setBackground(Color.lightGray);
   panDuomenys.setBorder(new TitledBorder("Knygų duomenys"));
   panDuomenys.setBackground(Color.lightGray);
   panAsmensDuo.setBackground(Color.white);
   panRez.setBackground(Color.white);
   panMygt.setBackground(Color.white);
 }
예제 #6
0
  /**
   * Cr�e une nouvelle instance de CreeTrans
   *
   * @param mf fenetre principale de l'application
   * @param zg Zone graphique
   * @param auto automate
   * @param be barre d'�tat
   */
  public TransCreator(MainFrame mf, GraphicZone g, Automate auto, StateBar be) {

    super(JOptionPane.getFrameForComponent(mf), "Creating interaction", true);

    this.setResizable(false);

    this.gz = g;
    this.auto = auto;
    this.bar = be;
    this.mf = mf;

    be.displayInfo("Creating interaction");

    tfJPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel1.setBackground(Color.lightGray);
    tfJPanel1.add(new JLabel("Type  : "));
    groupe = new CheckboxGroup();
    plus = new Checkbox("activator", groupe, true);
    tfJPanel1.add(plus);
    minus = new Checkbox("inhibitor", groupe, false);
    tfJPanel1.add(minus);

    tfJPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel2.setBackground(Color.lightGray);
    tfJPanel2.add(new JLabel("Threshold  = "));
    tf = new JTextField(auto.nbrCharTransLabel);
    tf.setText("1");
    tfJPanel2.add(tf);

    btJPanel = new JPanel(new GridLayout(1, 2, 0, 0));
    btJPanel.setBackground(Color.lightGray);
    ok = new Button("Ok");
    ok.setBackground(Color.lightGray);
    ok.addActionListener(this);
    cancel = new Button("Cancel");
    cancel.setBackground(Color.lightGray);
    cancel.addActionListener(this);
    btJPanel.add(ok);
    btJPanel.add(cancel);

    content = this.getContentPane();
    content.setLayout(new BorderLayout());
    content.setBackground(Color.lightGray);
    content.add(tfJPanel1, BorderLayout.NORTH);
    content.add(tfJPanel2, BorderLayout.CENTER);
    content.add(btJPanel, BorderLayout.SOUTH);

    this.pack();
    this.setLocationRelativeTo(this.mf);

    tf.requestFocusInWindow();

    // rendre la fenetre visible
    setVisible(true);
  }
예제 #7
0
  void initComponents() {
    JPanel mainPanel = new JPanel(new BorderLayout());
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    Color bgColor = Color.getHSBColor(0.58f, 0.17f, 0.95f);
    buttonPanel.setBackground(bgColor);
    Border empty = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    buttonPanel.setBorder(empty);

    textField = new JTextField(75);
    buttonPanel.add(textField);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchPHI = new JButton("Search PHI");
    searchPHI.addActionListener(this);
    buttonPanel.add(searchPHI);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchTrial = new JButton("Search Trial IDs");
    searchTrial.addActionListener(this);
    buttonPanel.add(searchTrial);

    buttonPanel.add(Box.createHorizontalStrut(20));
    buttonPanel.add(Box.createHorizontalGlue());
    saveAs = new JCheckBox("Save As...");
    saveAs.setBackground(bgColor);
    buttonPanel.add(saveAs);

    mainPanel.add(buttonPanel, BorderLayout.NORTH);

    JScrollPane scrollPane = new JScrollPane();
    textPane = new ColorPane();
    // textPane.setEditable(false);
    scrollPane.setViewportView(textPane);
    mainPanel.add(scrollPane, BorderLayout.CENTER);

    JPanel footerPanel = new JPanel();
    footerPanel.setLayout(new BoxLayout(footerPanel, BoxLayout.X_AXIS));
    footerPanel.setBackground(bgColor);
    message = new JLabel("Ready...");
    footerPanel.add(message);
    mainPanel.add(footerPanel, BorderLayout.SOUTH);

    setTitle(windowTitle);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
            System.exit(0);
          }
        });
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    pack();
    centerFrame();
  }
 private void kosmetika() {
   setTitle("Automobilių Queue ir Map struktūrų demo - KTU IF 2010");
   panAutoSąr.setBorder(
       new TitledBorder(
           "Neregistruotų automobilių eilė ir " + "registruotų automobilių Map struktūra"));
   panAutoSąr.setBackground(Color.yellow);
   panDuomenys.setBorder(new TitledBorder("Registracijos duomenys ir veiksmai"));
   panDuomenys.setBackground(Color.lightGray);
   panRegNumeris.setBackground(Color.green);
   panRez.setBackground(Color.gray);
   panMygt.setBackground(Color.magenta);
 }
예제 #9
0
 // Set up the quiz window
 Quiz() {
   initializeData();
   setTitle("FOSS Quiz App");
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   setSize(440, 400);
   setLocation(300, 100);
   setResizable(true);
   Container cont = getContentPane();
   cont.setLayout(null);
   cont.setBackground(Color.WHITE);
   bg = new ButtonGroup();
   choice1 = new JRadioButton("Choice1", true);
   choice2 = new JRadioButton("Choice2", false);
   choice3 = new JRadioButton("Choice3", false);
   choice4 = new JRadioButton("Choice4", false);
   bg.add(choice1);
   bg.add(choice2);
   bg.add(choice3);
   bg.add(choice4);
   lblmess = new JLabel("Choose a correct anwswer");
   lblmess.setForeground(Color.BLACK);
   lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15));
   btnext = new JButton("Next");
   btnext.setForeground(Color.WHITE);
   btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17));
   btnext.setBackground(Color.DARK_GRAY);
   btnext.addActionListener(this);
   panel = new JPanel();
   panel.setBackground(Color.WHITE);
   panel.setLocation(10, 60);
   panel.setSize(400, 300);
   panel.setLayout(new GridLayout(0, 1));
   title = new JPanel();
   title.setBackground(Color.WHITE);
   title.setLocation(10, 10);
   title.setSize(1000, 50);
   title.setLayout(new GridLayout(1, 0));
   title.add(lblmess);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   cont.add(title);
   cont.add(panel);
   setVisible(true);
   quizAnswerID = 0;
   readQuestionAnswer(quizAnswerID);
 }
예제 #10
0
  private void buildPanel() {
    messageLabel = new JLabel("Enter a distance in Kilometers");

    kiloTextField = new JTextField(10);

    setColorCyan = new JButton("Cyanize");
    setColorGreen = new JButton("makeGreen");

    calcButton = new JButton("Calcumalate");

    ImageIcon image1 = new ImageIcon("10d.jpg");
    image = new JLabel(image1);
    calcButton.setForeground(Color.BLUE);

    calcButton.addActionListener(new calcButtonListener());
    setColorCyanListener listener = new setColorCyanListener();
    setColorCyan.addActionListener(listener);

    setColorGreenListener listenerG = new setColorGreenListener();
    setColorGreen.addActionListener(listenerG);
    calcButton.setIcon(image1);
    panel = new JPanel();

    panel.setLayout(new GridLayout(3, 3));
    panel.setBackground(Color.RED);
    panel.add(messageLabel);
    panel.add(kiloTextField);
    panel.add(calcButton);
    panel.add(setColorCyan);
    panel.add(setColorGreen);
    panel.add(image);
  }
예제 #11
0
  protected void setBgColor(Color bgColor) {
    setBackgroundColor(bgColor);

    panelForBtns.setBackground(Util.getBgColor());
    addButton.setBackground(Util.getBgColor());
    removeButton.setBackground(Util.getBgColor());
  }
  private void createHealthPanel() {

    remove(healthPanel);
    remove(statsPanel);

    lblPlayerHealth.setText(
        "<html><font color='green'>" + GamePanel.healthPlayer + "</font></html>");
    lblMrSawyerHealth.setText(
        "<html><font color='green'>" + GamePanel.healthMrSawyer + "</font></html>");
    lblVikrantHealth.setText(
        "<html><font color='green'>" + GamePanel.healthVikrant + "</font></html>");
    lblVarunHealth.setText("<html><font color='green'>" + GamePanel.healthVarun + "</font></html>");
    lblBrianHealth.setText("<html><font color='green'>" + GamePanel.healthBrian + "</font></html>");

    healthPanel.setLayout(new GridLayout(5, 2));
    healthPanel.setBackground(new Color(0xd2b48c));
    healthPanel.add(lblPlayerName);
    healthPanel.add(lblPlayerHealth);
    healthPanel.add(lblMrSawyerName);
    healthPanel.add(lblMrSawyerHealth);
    healthPanel.add(lblVikrantName);
    healthPanel.add(lblVikrantHealth);
    healthPanel.add(lblVarunName);
    healthPanel.add(lblVarunHealth);
    healthPanel.add(lblBrianName);
    healthPanel.add(lblBrianHealth);

    add(healthPanel, BorderLayout.WEST);

    revalidate();
    repaint();
  }
예제 #13
0
 public void selectRow(int index) {
   int count = 0;
   for (JPanel row : rows) {
     if (count % 2 == 0) {
       row.setBackground(new Color(200, 200, 230));
     } else {
       row.setBackground(new Color(240, 240, 240));
     }
     ++count;
   }
   if (index != -1) {
     rows.get(index).setBackground(new Color(170, 250, 170));
   }
   repaint();
   updateUI();
 }
예제 #14
0
  private void prepareSearchArea() {
    searchPanes = new CollapsiblePanes();
    searchPanes.setLayout(new JideBoxLayout(searchPanes, JideBoxLayout.Y_AXIS));
    jspSearch.setViewportView(searchPanes);

    JPanel mypanel = new JPanel();
    mypanel.setLayout(new VerticalLayout(3));
    mypanel.setBackground(Color.WHITE);

    CollapsiblePane searchPane = new CollapsiblePane(SYSTools.xx(internalClassID));
    searchPane.setStyle(CollapsiblePane.PLAIN_STYLE);
    searchPane.setCollapsible(false);

    try {
      searchPane.setCollapsed(false);
    } catch (PropertyVetoException e) {
      OPDE.error(e);
    }

    GUITools.addAllComponents(mypanel, addCommands());

    searchPane.setContentPane(mypanel);

    searchPanes.add(searchPane);
    searchPanes.addExpansion();
  }
예제 #15
0
  public TestPanel3() {

    super();

    contentPanel = getContentPanel();
    ImageIcon icon = getImageIcon();

    titlePanel = new javax.swing.JPanel();
    textLabel = new javax.swing.JLabel();
    iconLabel = new javax.swing.JLabel();
    separator = new javax.swing.JSeparator();

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

    titlePanel.setLayout(new java.awt.BorderLayout());
    titlePanel.setBackground(Color.gray);

    textLabel.setBackground(Color.gray);
    textLabel.setFont(new Font("MS Sans Serif", Font.BOLD, 14));
    textLabel.setText("Pretending To Connect To Server");
    textLabel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
    textLabel.setOpaque(true);

    iconLabel.setBackground(Color.gray);
    if (icon != null) iconLabel.setIcon(icon);

    titlePanel.add(textLabel, BorderLayout.CENTER);
    titlePanel.add(iconLabel, BorderLayout.EAST);
    titlePanel.add(separator, BorderLayout.SOUTH);

    add(titlePanel, BorderLayout.NORTH);
    JPanel secondaryPanel = new JPanel();
    secondaryPanel.add(contentPanel, BorderLayout.NORTH);
    add(secondaryPanel, BorderLayout.WEST);
  }
예제 #16
0
  void makeFrame() {
    JPanel p = new JPanel();
    p.setBackground(Color.blue);
    p.setLayout(new BorderLayout(0, 0));
    p.setBorder(new EmptyBorder(0, GAP, GAP, GAP));
    days.setFont(BIG);
    days.setForeground(COLOR);
    p.add(days, "North");
    left.setFont(NORM);
    left.setForeground(COLOR);
    p.add(left, "South");

    JFrame f = new JFrame("Sayaç"); // a window
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    f.setContentPane(p);
    setDate();
    f.pack(); // minimal size
    f.setVisible(true); // show

    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            stop();
          }
        });
  }
 public ControlPanel(DrawingPanel canvas) {
   // instance variable draw has been assigned to canvas
   this.draw = canvas;
   // adds new Button
   this.color = new JButton("Add Color");
   // assigns a listener with the button
   this.color.addActionListener(new ColorButton());
   // adds button to the JPanel
   this.add(this.color);
   // asigns currentColor to a new JPanel
   this.currentColor = new JPanel();
   // adds currentColor to JPanel
   this.add(this.currentColor);
   // sets background to default color
   currentColor.setBackground(draw.getColor());
   // adds a new Button
   this.circle = new JButton("Add Circle");
   // asigns a listener to the button
   this.circle.addActionListener(new CircleButton());
   // adds button to the panel
   this.add(this.circle);
   // adds new button
   this.square = new JButton("Add Square");
   // asigns this button to a listener
   this.square.addActionListener(new SquareButton());
   // adds button to the panel
   this.add(this.square);
 }
  public UpgradesPanel(ORUIManager orUIManager) {
    super(BoxLayout.Y_AXIS);

    this.orUIManager = orUIManager;

    preferredSize = new Dimension((int) Math.round(100 * (2 + Scale.getFontScale()) / 3), 200);
    setSize(preferredSize);
    setVisible(true);

    upgradePanel = new JPanel();

    upgradePanel.setOpaque(true);
    upgradePanel.setBackground(Color.DARK_GRAY);
    upgradePanel.setBorder(border);
    upgradePanel.setLayout(new GridLayout(defaultNbPanelElements, 1));

    scrollPane = new JScrollPane(upgradePanel);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setSize(getPreferredSize());

    doneButton.setActionCommand("Done");
    doneButton.setMnemonic(KeyEvent.VK_D);
    doneButton.addActionListener(this);
    cancelButton.setActionCommand("Cancel");
    cancelButton.setMnemonic(KeyEvent.VK_C);
    cancelButton.addActionListener(this);

    add(scrollPane);
  }
  private void initUI() {

    JPanel infoPanel = new JPanel();
    infoPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    infoPanel.setBackground(Color.WHITE);
    infoPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));

    infoPanel.add(
        new JLabel(
            new ImageIcon(
                Thread.currentThread().getContextClassLoader().getResource("siw-logo3_2.gif"))));

    JLabel textLabel = new JLabel("<html>Confirmation</html>");

    infoPanel.add(textLabel);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(0, 1));

    buttonPanel.add(reportLabel);

    this.setLayout(new BorderLayout());
    this.add(infoPanel, BorderLayout.NORTH);
    this.add(buttonPanel, BorderLayout.CENTER);
  }
  /**
   * Method to display pixel information for the passed x and y
   *
   * @param pictureX the x value in the picture
   * @param pictureY the y value in the picture
   */
  private void displayPixelInformation(int pictureX, int pictureY) {
    // check that this x and y are in range
    if (isLocationInPicture(pictureX, pictureY)) {
      // save the current x and y index
      colIndex = pictureX;
      rowIndex = pictureY;

      // get the pixel at the x and y
      Pixel pixel = new Pixel(picture, colIndex, rowIndex);

      // set the values based on the pixel
      colValue.setText(Integer.toString(colIndex + numberBase));
      rowValue.setText(Integer.toString(rowIndex + numberBase));
      rValue.setText("R: " + pixel.getRed());
      gValue.setText("G: " + pixel.getGreen());
      bValue.setText("B: " + pixel.getBlue());
      colorPanel.setBackground(new Color(pixel.getRed(), pixel.getGreen(), pixel.getBlue()));

    } else {
      clearInformation();
    }

    // notify the image display of the current x and y
    imageDisplay.setCurrentX((int) (colIndex * zoomFactor));
    imageDisplay.setCurrentY((int) (rowIndex * zoomFactor));
  }
 private JComponent createRecentProjects() {
   JPanel panel = new JPanel(new BorderLayout());
   panel.add(new NewRecentProjectPanel(this), BorderLayout.CENTER);
   panel.setBackground(getProjectsBackground());
   panel.setBorder(new CustomLineBorder(getSeparatorColor(), JBUI.insetsRight(1)));
   return panel;
 }
예제 #22
0
파일: PlusMinus.java 프로젝트: sha8e/purdue
 public void createPanel() {
   panel = new JPanel(new GridLayout(3, 1)); // A panel object is created;
   panel.setBackground(Color.GREEN); // Set the background color of the panel
   panel.add(buttonPlus); // Add the button object to the panel
   panel.add(buttonMinus); // and the other one also.
   panel.add(text); // Add the text object to the panel.
 }
예제 #23
0
  public hostelStatus() {
    setTitle("Hostel");
    connect();
    updateRecord();

    JFrame fr = new JFrame();
    Toolkit tkt = fr.getToolkit();
    Dimension frsize = tkt.getScreenSize();
    setBounds(frsize.width / 4, frsize.height / 12, frsize.width / 2, frsize.height / 8);
    setLayout(null);

    cn = getContentPane();
    cn.setBackground(new Color(190, 180, 170));

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    tl = new JLabel("Current Hostels Status");
    tl.setFont(new Font("Engravers MT", 1, 25));
    tl.setForeground(new Color(247, 251, 249));

    p1 = new JPanel();
    p1.setBounds(0, 0, 600, 50);
    p1.add(tl);
    p1.setBackground(new Color(31, 88, 166));
    cn.add(p1);

    b1 = new JButton("LOAD");
    b1.setMnemonic('L');
    b1.addActionListener(new dispListener());
    b1.setBounds(230, 320, 120, 30);

    b2 = new JButton("EXIT");
    b2.setMnemonic('X');
    b2.addActionListener(new exitListener());
    b2.setBounds(350, 320, 100, 30);

    cn.add(b1);
    cn.add(b2);

    table = new JTable(data, col);
    table.setFont(new Font("Serif", Font.BOLD, 16));
    table.setBackground(new Color(250, 250, 250));
    table.setEnabled(false);

    JScrollPane jsp = new JScrollPane(table);
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBounds(5, 100, 590, 200);
    cn.add(jsp);

    screensize = Toolkit.getDefaultToolkit().getScreenSize();

    setSize(600, 400);
    setVisible(true);
    setVisible(true);
    setResizable(true);
    connect();
  }
예제 #24
0
  private void repaintContent() {
    if (content != null) {
      remove(content);
    }
    content = new JPanel();

    content.setLayout(new GridBagLayout());
    content.setBackground(Colors.TEMPLATE);
    int gridY = 0;
    GridBagConstraints c;
    for (Parameter p : shownParams.getParamList()) {
      c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = gridY;
      c.anchor = GridBagConstraints.WEST;
      c.fill = GridBagConstraints.NONE;
      c.insets = new Insets(0, 0, 0, 8);
      content.add(new JLabel(p.getName()), c);

      c = new GridBagConstraints();
      c.gridx = 1;
      c.gridy = gridY++;
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1;
      final Parameter pFinal = p;
      final JTextField jTextField = new DJTextField();
      jTextField.setText(p.getValue());
      jTextField.addKeyListener(
          new KeyListener() {
            public void keyTyped(KeyEvent keyEvent) {
              // TODO
            }

            public void keyPressed(KeyEvent keyEvent) {
              // TODO
            }

            public void keyReleased(KeyEvent keyEvent) {
              pFinal.setValue(jTextField.getText());
            }
          });
      content.add(jTextField, c);
    }

    GridBagConstraints nc = new GridBagConstraints();
    nc.gridx = 0;
    nc.gridy = 0;
    nc.weightx = 1;
    nc.fill = GridBagConstraints.HORIZONTAL;

    add(content, nc);

    content.updateUI();
    content.repaint();
    this.repaint();
  }
예제 #25
0
  private void loadPreferences() {
    // grab the preferences so that they can be used to fill out the layout
    ThumbMakerPreferences myPreferences = ThumbMakerPreferences.getInstance();

    // x resolution text box
    xres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME));

    // y resolution text box
    yres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME));

    // aspect ratio checkbox
    aspect.setSelected(
        myPreferences
            .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME)
            .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING));

    // load the color values from the preferences
    int redValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME);
    int greenValueNumber =
        myPreferences.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME);
    int blueValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME);

    // set the background color image
    colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber));

    // red slider
    red.setValue(redValueNumber);
    redValue.setText("" + redValueNumber);

    // green slider
    green.setValue(greenValueNumber);
    greenValue.setText("" + greenValueNumber);

    // blue slider
    blue.setValue(blueValueNumber);
    blueValue.setText("" + blueValueNumber);

    // algorithm combo box
    algorithm.setSelectedIndex(
        myPreferences.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME));

    // format combo box
    format.setSelectedIndex(
        myPreferences.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME));

    // prepend field
    prepend.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME));

    // append field
    append.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME));

    // output folder field
    output.setText(
        (new File(myPreferences.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME)))
            .getAbsolutePath());
  }
예제 #26
0
 private void jbInit() throws Exception {
   panel1.setLayout(xYLayout1);
   panel1.setBackground(new Color(251, 236, 175));
   jToggleButton5.setText("Done");
   jToggleButton5.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jToggleButton5_actionPerformed(e);
         }
       });
   jLabel1.setToolTipText("");
   jList1.addMouseListener(
       new java.awt.event.MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           jList1_mouseClicked(e);
         }
       });
   HireFire.setText("Hire/Fire");
   HireFire.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           HireFire_actionPerformed(e);
         }
       });
   jButtonAdvertise.setText("Advertise");
   jButtonAdvertise.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jButtonAdvertise_actionPerformed(e);
         }
       });
   jTextFieldWage.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jTextFieldWage_actionPerformed(e);
         }
       });
   jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
   jLabel3.setText("Amount");
   jLabel5.setText("jLabel5");
   jTextFieldWage.setText("100");
   panel1.add(jList1, new XYConstraints(9, 10, 206, 250));
   panel1.add(jTextPane2, new XYConstraints(9, 262, 467, 109));
   panel1.add(jLabel1, new XYConstraints(476, 9, 10, 226));
   panel1.add(jLabel2, new XYConstraints(2, 454, 58, 12));
   panel1.add(jToggleButton5, new XYConstraints(385, 397, 75, 26));
   panel1.add(HireFire, new XYConstraints(9, 429, 134, 26));
   panel1.add(jPanel1, new XYConstraints(217, 10, 259, 250));
   this.getContentPane().add(panel1, BorderLayout.SOUTH);
   panel1.add(jButtonAdvertise, new XYConstraints(183, 401, 116, -1));
   panel1.add(jTextFieldWage, new XYConstraints(69, 403, 102, 24));
   panel1.add(jLabel3, new XYConstraints(19, 400, 46, 29));
   panel1.add(jLabel4, new XYConstraints(155, 460, 44, 6));
   panel1.add(jLabel5, new XYConstraints(507, 92, 5, 47));
   this.setVisible(true);
 }
 /** Method to clear the labels and current color and reset the current index to -1 */
 private void clearInformation() {
   colValue.setText("N/A");
   rowValue.setText("N/A");
   rValue.setText("R: N/A");
   gValue.setText("G: N/A");
   bValue.setText("B: N/A");
   colorPanel.setBackground(Color.black);
   colIndex = -1;
   rowIndex = -1;
 }
  @Override
  public JComponent getContent() {

    if (this.obj == null) {

      throw new IllegalStateException("No object set.");
    }

    // TODO: Make this nicer later.
    if (this.obj instanceof Chapter) {

      Chapter c = (Chapter) this.obj;

      JComponent t = UIUtils.getChapterInfoPreview(c, null, this.viewer);

      if (t == null) {

        // May be a fake chapter, return null.
        return null;
      }

      t.setSize(new Dimension(300, Short.MAX_VALUE));

      return t;

    } else {

      String firstLine = "<b><i>No description.</i></b>";

      String t = (obj.getDescription() != null ? obj.getDescription().getText() : null);

      if ((t != null) && (t.length() > 0)) {

        firstLine = new Paragraph(t, 0).getFirstSentence().getText();
      }

      JEditorPane desc = UIUtils.createHelpTextPane(firstLine, null);

      FormLayout fl = new FormLayout("380px", "p");

      PanelBuilder pb = new PanelBuilder(fl);

      CellConstraints cc = new CellConstraints();

      pb.add(desc, cc.xy(1, 1));

      desc.setAlignmentX(Component.LEFT_ALIGNMENT);

      JPanel p = pb.getPanel();
      p.setOpaque(true);
      p.setBackground(UIUtils.getComponentColor());

      return p;
    }
  }
예제 #29
0
  public MainPanel() {
    super(new GridLayout(0, 1));
    orgImage = new ImageIcon(getClass().getResource("i03-10.gif"));

    JPanel p1 = new JPanel(new GridLayout(1, 2));
    p1.add(makeLabel(makeGrayImageIcon1(orgImage.getImage()), "ColorConvertOp"));
    p1.add(makeLabel(makeGrayImageIcon2(orgImage.getImage()), "TYPE_BYTE_GRAY"));
    add(p1);
    add(makeLabel(makeGrayImageIcon3(orgImage.getImage()), "GrayFilter.createDisabledImage"));
    JPanel p3 = new JPanel(new GridLayout(1, 2));
    p3.add(makeLabel(makeGrayImageIcon4(orgImage.getImage()), "GrayFilter(true, 50)"));
    p3.add(makeLabel(makeGrayImageIcon5(orgImage.getImage()), "GrayImageFilter"));
    add(p3);

    p1.setBackground(Color.WHITE);
    p3.setBackground(Color.WHITE);
    setBackground(Color.WHITE);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(320, 240));
  }
예제 #30
0
 public void actionPerformed(ActionEvent e) {
   for (int k = 0; k <= 4; k++) {
     // 先將全部顏色按鈕還原為浮凸狀
     btnCr[k].setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
     if (e.getSource() == btnCr[k]) {
       pane.setBackground(cr[k]);
       // 被點按的顏色按鈕呈凹陷狀
       btnCr[k].setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
     }
   }
 }