Example usage for java.awt Font PLAIN

List of usage examples for java.awt Font PLAIN

Introduction

In this page you can find the example usage for java.awt Font PLAIN.

Prototype

int PLAIN

To view the source code for java.awt Font PLAIN.

Click Source Link

Document

The plain style constant.

Usage

From source file:unalcol.termites.boxplots.RoundNumberGlobal.java

/**
 * Creates a new demo./*w  w  w .  ja  v  a2 s  .c  om*/
 *
 * @param title the frame title.
 * @param pf
 */
public RoundNumberGlobal(final String title, ArrayList<Double> pf) {

    super(title);

    final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf);

    final CategoryAxis xAxis = new CategoryAxis("");
    //final NumberAxis yAxis = new NumberAxis("Round number");
    final NumberAxis yAxis = new NumberAxis("");
    yAxis.setAutoRangeIncludesZero(false);
    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
    final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    Font font = new Font("Dialog", Font.PLAIN, 16);
    xAxis.setTickLabelFont(font);
    yAxis.setTickLabelFont(font);
    yAxis.setLabelFont(font);

    final JFreeChart chart = new JFreeChart("Round Number" + getTitle(pf), new Font("SansSerif", Font.BOLD, 18),
            plot, true);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));
    setContentPane(chartPanel);

    TextTitle legendText = null;
    if (pf.size() == 1) {
        legendText = new TextTitle("Population Size");
    } else {
        legendText = new TextTitle("Population Size - Probability of Failure");
    }

    legendText.setFont(font);
    legendText.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendText);
    chart.getLegend().setItemFont(font);

    FileOutputStream output;
    try {
        output = new FileOutputStream("roundGlobalNumber" + pf + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(RoundNumberGlobal.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(RoundNumberGlobal.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:unalcol.termites.boxplots.MessagesSent1.java

/**
 * Creates a new demo.//  ww  w. j  av  a 2  s.  c  o  m
 *
 * @param title the frame title.
 * @param pf
 */
public MessagesSent1(final String title, ArrayList<Double> pf) {

    super(title);

    final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf);

    final CategoryAxis xAxis = new CategoryAxis("");
    //final NumberAxis yAxis = new NumberAxis("Messages Sent");
    final NumberAxis yAxis = new NumberAxis("");
    yAxis.setAutoRangeIncludesZero(false);
    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
    final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    Font font = new Font("Dialog", Font.PLAIN, 16);
    xAxis.setTickLabelFont(font);
    yAxis.setTickLabelFont(font);
    yAxis.setLabelFont(font);

    final JFreeChart chart = new JFreeChart("Messages Sent " + getTitle(pf),
            new Font("SansSerif", Font.BOLD, 18), plot, true);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));
    setContentPane(chartPanel);
    TextTitle legendText = null;
    if (pf.size() == 1) {
        legendText = new TextTitle("Population Size");
    } else {
        legendText = new TextTitle("Population Size - Probability of Failure");
    }
    legendText.setFont(font);
    legendText.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendText);
    chart.getLegend().setItemFont(font);

    FileOutputStream output;
    try {
        output = new FileOutputStream("messagesnumber1" + pf + mazeMode + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(MessagesSent1.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:BenchmarkApplet.java

public void init() {
      tgroup = Thread.currentThread().getThreadGroup();

      Font font = new Font("Courier", Font.PLAIN, 10);
      FontMetrics fm = getFontMetrics(font);
      int lines = Math.max(10, size().height / fm.getHeight() - 4);

      out = new TextArea(lines, spaces.length() + Benchmark.resolutionName.length());
      out.setFont(font);/*from   w  w w.  ja  v  a2 s.c om*/
      out.setEditable(false);
      add(out);

      boolean toobig;
      do {
          testList = new List(--lines, true);
          add(testList, 0);
          validate();
          if (toobig = testList.size().height - out.size().height > 2)
              remove(testList);
      } while (toobig);
      for (int ii = 0; ii < tests.length; ii++)
          testList.addItem(tests[ii].getName());
      testList.select(0); // Calibration benchmark
      testList.select(1); // Mixed benchmark

      timeEstimate = new Label(getTimeEstimate());
      add(timeEstimate);

      add(doit = new Button("Run Benchmark"));
      add(abort = new Button("Stop"));
      add(clear = new Button("Clear"));
      abort.disable();
      clear.disable();

      add(console = new Checkbox("Console"));

      validate();
  }

From source file:Interface.FoodCollectionSupervisor.FoodCollectionWorkArea.java

public FoodCollectionWorkArea(JPanel userProcessContainer, UserAccount account) {

    initComponents();/*www.  j av a  2s  .co  m*/
    this.userProcessContainer = userProcessContainer;
    this.account = account;

    community = account.getEmployee().getCommunityAssociated();
    empSupervisor = (FoodCollectionSupervisorEmployee) account.getEmployee();
    organization = (FoodCollectionOrganization) community.getFoodCollectionOrg();

    populateNewRequestTable();
    populateAssignedRequestTable();
    populateCompletedRequestTable();
    populateCombobox();
    populateDriverUseraccount();
    lbErrlEmpName.setVisible(false);
    lblErrAddress.setVisible(false);
    lblPassword.setVisible(false);
    lblUsername.setVisible(false);
    jScrollPane6.setVisible(false);
    tblNewRequest.getTableHeader().setFont(new Font("Tahoma", Font.PLAIN, 18));
    tblAssignedRequests.getTableHeader().setFont(new Font("Tahoma", Font.PLAIN, 18));
    tblCompletedRequests.getTableHeader().setFont(new Font("Tahoma", Font.PLAIN, 18));
    tblDriverUserAccount.getTableHeader().setFont(new Font("Tahoma", Font.PLAIN, 18));

}

From source file:utybo.easypastebin.windows.MainWindow.java

/**
 * Creates the window/* w  w  w  . j  av  a  2s.  c om*/
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public MainWindow() {
    EasyPastebin.LOGGER.log("Initializing the window", SinkJLevel.INFO);
    setTitle("EasyPastebin");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 664, 431);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    contentPane.add(tabbedPane, BorderLayout.CENTER);

    JPanel main = new JPanel();
    tabbedPane.addTab("EasyPastebin", null, main, null);
    main.setLayout(null);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(62, 39, 312, 132);
    main.add(scrollPane);

    pasteContent = new JTextArea();
    pasteContent.setFont(new Font("Monospaced", Font.PLAIN, 11));
    pasteContent.setWrapStyleWord(true);
    pasteContent.setLineWrap(true);
    pasteContent.setToolTipText("Put your paste here!");
    scrollPane.setViewportView(pasteContent);

    JLabel titleLabel = new JLabel("Title :");
    titleLabel.setFont(new Font("Tahoma", Font.PLAIN, 12));
    titleLabel.setBounds(10, 11, 42, 21);
    main.add(titleLabel);

    pasteTitle = new JTextField();
    pasteTitle.setBounds(62, 12, 312, 20);
    main.add(pasteTitle);
    pasteTitle.setColumns(10);

    JLabel lblPaste = new JLabel("Paste :");
    lblPaste.setForeground(Color.RED);
    lblPaste.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblPaste.setBounds(10, 85, 53, 21);
    main.add(lblPaste);

    pasteExpireDate = new JComboBox();
    pasteExpireDate.setFont(new Font("Tahoma", Font.PLAIN, 12));
    pasteExpireDate.setModel(new DefaultComboBoxModel(EnumExpireDate.values()));
    pasteExpireDate.setBounds(468, 12, 155, 21);
    main.add(pasteExpireDate);

    JLabel lblExpireDate = new JLabel("Expire Date :");
    lblExpireDate.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblExpireDate.setBounds(384, 14, 81, 14);
    main.add(lblExpireDate);

    JLabel lblfieldsInRed = new JLabel("(Fields in red are required)");
    lblfieldsInRed.setBounds(72, 182, 302, 14);
    main.add(lblfieldsInRed);

    btnSubmit = new JButton("Submit!");
    btnSubmit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            EasyPastebin.LOGGER.log("Starting Submit script", SinkJLevel.INFO);
            btnSubmit.setEnabled(false);
            btnSubmit.setText("Please wait...");

            boolean success = true;
            String paste = pasteContent.getText();
            String title = pasteTitle.getText();
            EnumExpireDate expireDate = (EnumExpireDate) pasteExpireDate.getSelectedItem();

            if (paste.equals("") || paste.equals(" ") || paste.equals(null)) {
                pastebinUrl.setText("ERROR");
                JOptionPane.showMessageDialog(null, "You cannot send empty pastes!",
                        "Error while processing paste", JOptionPane.ERROR_MESSAGE);
            } else {
                try {
                    EasyPastebin.LOGGER.log("Setting options", SinkJLevel.INFO);
                    Map map = new HashMap<String, String>();
                    map.put("api_dev_key", HttpHelper.API_KEY);
                    map.put("api_option", "paste");
                    map.put("api_paste_code", paste);
                    if (!(expireDate.equals(null) || expireDate.equals(EnumExpireDate.NEVER)))
                        map.put("api_paste_expire_date", expireDate.getRawName());
                    if (!(title.equals("") || title.equals(" ") || title.equals(null)))
                        map.put("api_paste_name", title);

                    EasyPastebin.LOGGER.log("Sending paste", SinkJLevel.INFO);
                    String actionResult = HttpHelper.sendPost("http://pastebin.com/api/api_post.php", map)
                            .asString();
                    EasyPastebin.LOGGER.log("Paste sent, checking output", SinkJLevel.INFO);
                    // Exception handlers
                    if (actionResult.equals("Bad API request, invalid api_option")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Incorrect Pastebin option!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_dev_key")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Incorrect dev key! Try again with a more recent version!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, IP blocked")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null, "Error while processing paste. Your IP is blocked!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals(
                            "Bad API request, maximum number of 25 unlisted pastes for your free account")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals(
                            "Bad API request, maximum number of 10 private pastes for your free account")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals("Bad API request, api_paste_code was empty")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals("Bad API request, maximum paste file size exceeded")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Your paste is too big!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_expire_date")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Invalid expire date!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_paste_private")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Invalid privacy value!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_paste_format")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null, "Error while processing paste. Invalid format!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    // END

                    // Starting display stuff
                    if (success == false) {
                        EasyPastebin.LOGGER.log("Submit script failed : success == false", SinkJLevel.ERROR);
                        pastebinUrl.setText("ERROR");
                    }
                    if (success == true) {
                        EasyPastebin.LOGGER.log("Paste sent! Starting display script!", SinkJLevel.INFO);
                        pastebinUrl.setText(actionResult);
                        JOptionPane.showMessageDialog(null, "Paste successfully sent!", "Done!",
                                JOptionPane.INFORMATION_MESSAGE);
                        EasyPastebin.LOGGER.log("Display script finished! Paste URL is : " + actionResult,
                                SinkJLevel.INFO);
                    }

                } catch (ClientProtocolException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e, "Error",
                            JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                } catch (IOException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e, "Error",
                            JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                } catch (MissingParamException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e
                            + "! This is a severe programming error! Try again with a more recent version!",
                            "Error", JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                }
            }

            EasyPastebin.LOGGER.log("Re-enabling the Submit button ", SinkJLevel.INFO);
            btnSubmit.setEnabled(true);
            btnSubmit.setText("Submit another paste!");
            EasyPastebin.LOGGER.log("Finished submit script! Success : " + success, SinkJLevel.INFO);
        }
    });
    btnSubmit.setBounds(386, 45, 237, 44);
    main.add(btnSubmit);

    pastebinUrl = new JTextField();
    pastebinUrl.setText("The paste's URL will be shown here!");
    pastebinUrl.setEditable(false);
    pastebinUrl.setBounds(384, 198, 239, 32);
    main.add(pastebinUrl);
    pastebinUrl.setColumns(10);

    JPanel about = new JPanel();
    tabbedPane.addTab("About", null, about, null);

    JLabel label = new JLabel("EasyPastebin");
    label.setBounds(12, 12, 623, 39);
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setFont(new Font("Dialog", Font.PLAIN, 25));

    JLabel lblTheEasiestWay = new JLabel("The easiest way to use Pastebin.com");
    lblTheEasiestWay.setBounds(12, 63, 623, 32);
    lblTheEasiestWay.setFont(new Font("Dialog", Font.PLAIN, 16));
    lblTheEasiestWay.setHorizontalAlignment(SwingConstants.CENTER);
    about.setLayout(null);
    about.add(label);
    about.add(lblTheEasiestWay);

    JButton btnForkM = new JButton("Fork me on Github!");
    btnForkM.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("https://github.com/utybo/EasyPastebin");
        }
    });
    btnForkM.setBounds(12, 117, 623, 25);
    about.add(btnForkM);

    JButton btnCheckOutUtybos = new JButton("Check out utybo's projects!");
    btnCheckOutUtybos.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("http://utybo.github.io/");
        }
    });
    btnCheckOutUtybos.setBounds(12, 154, 623, 25);
    about.add(btnCheckOutUtybos);

    JButton btnGoToPastebincom = new JButton("Go to Pastebin.com!");
    btnGoToPastebincom.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("http://www.pastebin.com");
        }
    });
    btnGoToPastebincom.setBounds(12, 191, 623, 25);
    about.add(btnGoToPastebincom);

    JLabel lblcUtybo = new JLabel(
            "This soft was made by utybo. It uses Apache's libraries for the interaction with Pastebin's API");
    lblcUtybo.setFont(new Font("Dialog", Font.PLAIN, 10));
    lblcUtybo.setHorizontalAlignment(SwingConstants.CENTER);
    lblcUtybo.setBounds(12, 324, 623, 15);
    about.add(lblcUtybo);

    JLabel lblClickMeTo = new JLabel("Click me to go to Apache's licence official website");
    lblClickMeTo.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            goToUrl("http://www.apache.org/licenses/LICENSE-2.0");
        }
    });
    lblClickMeTo.setHorizontalAlignment(SwingConstants.CENTER);
    lblClickMeTo.setFont(new Font("Dialog", Font.PLAIN, 10));
    lblClickMeTo.setBounds(12, 342, 623, 15);
    about.add(lblClickMeTo);

    setVisible(true);

    EasyPastebin.LOGGER.log("Done!", SinkJLevel.INFO);
}

From source file:es.uvigo.ei.sing.adops.views.TextFileViewer.java

public TextFileViewer(final File file) {
    super(new BorderLayout());

    this.file = file;

    // TEXT AREA//from w ww.ja  va 2s  .co m
    this.textArea = new JTextArea(TextFileViewer.loadFile(file));
    this.textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, this.textArea.getFont().getSize()));
    this.textArea.setLineWrap(true);
    this.textArea.setWrapStyleWord(true);
    this.textArea.setEditable(false);

    this.highlightPatiner = new DefaultHighlighter.DefaultHighlightPainter(Color.YELLOW);

    // OPTIONS PANEL
    final JPanel panelOptions = new JPanel(new BorderLayout());
    final JPanel panelOptionsEast = new JPanel(new FlowLayout());
    final JPanel panelOptionsWest = new JPanel(new FlowLayout());
    final JCheckBox chkLineWrap = new JCheckBox("Line wrap", true);
    final JButton btnChangeFont = new JButton("Change Font");

    final JLabel lblSearch = new JLabel("Search");
    this.txtSearch = new JTextField();
    this.chkRegularExpression = new JCheckBox("Reg. exp.", true);
    final JButton btnSearch = new JButton("Search");
    final JButton btnClear = new JButton("Clear");
    this.txtSearch.setColumns(12);
    // this.txtSearch.setOpaque(true);

    panelOptionsEast.add(btnChangeFont);
    panelOptionsEast.add(chkLineWrap);
    panelOptionsWest.add(lblSearch);
    panelOptionsWest.add(this.txtSearch);
    panelOptionsWest.add(this.chkRegularExpression);
    panelOptionsWest.add(btnSearch);
    panelOptionsWest.add(btnClear);

    if (FastaUtils.isFasta(file)) {
        panelOptionsWest.add(new JSeparator());

        final JButton btnExport = new JButton("Export...");

        panelOptionsWest.add(btnExport);

        btnExport.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    new ExportDialog(file).setVisible(true);
                } catch (Exception e1) {
                    JOptionPane.showMessageDialog(Workbench.getInstance().getMainFrame(),
                            "Error reading fasta file: " + e1.getMessage(), "Export Error",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        });
    }

    panelOptions.add(panelOptionsWest, BorderLayout.WEST);
    panelOptions.add(panelOptionsEast, BorderLayout.EAST);

    this.fontChooser = new JFontChooser();

    this.add(new JScrollPane(this.textArea), BorderLayout.CENTER);
    this.add(panelOptions, BorderLayout.NORTH);

    chkLineWrap.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            textArea.setLineWrap(chkLineWrap.isSelected());
        }
    });

    btnChangeFont.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            changeFont();
        }
    });

    this.textArea.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            TextFileViewer.this.wasModified = true;
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            TextFileViewer.this.wasModified = true;
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            TextFileViewer.this.wasModified = true;
        }
    });

    this.textArea.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            if (TextFileViewer.this.wasModified) {
                try {
                    FileUtils.write(TextFileViewer.this.file, TextFileViewer.this.textArea.getText());
                    TextFileViewer.this.wasModified = false;
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
        }
    });

    final ActionListener alSearch = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateSearch();
        }
    };
    txtSearch.addActionListener(alSearch);
    btnSearch.addActionListener(alSearch);

    btnClear.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            clearSearch();
        }
    });
}

From source file:edu.stanford.epadd.launcher.Splash.java

void setSplashText(String text) {
    if (splash == null)
        return;/*www.ja  va2 s  . co  m*/

    int SPLASH_SCREEN_WIDTH = ((int) splash.getBounds().getWidth());
    int MARGIN = 10; // margin for text on each side

    // clear the previous text
    g.setColor(new Color(1, 117, 188)); // epadd color, #0175bc
    g.fillRect(0, 175, SPLASH_SCREEN_WIDTH, 40);
    g.setPaintMode();

    // write the new text
    g.setColor(Color.WHITE); // #0175bc
    g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14));

    // compute the startX so as to center align the string,
    int stringWidth = g.getFontMetrics().stringWidth(text);
    int startX = (stringWidth > (SPLASH_SCREEN_WIDTH - MARGIN * 2)) ? MARGIN
            : MARGIN + (SPLASH_SCREEN_WIDTH - stringWidth) / 2;
    g.drawString(text, startX, 200);

    splash.update();
}

From source file:statUtil.TurnMovementPlot.java

public TurnMovementPlot(String title) throws IOException {
    super(title);
    Data data = CSVData.getCSVData(TURN_CSV_LOG);
    JFreeChart chart = ChartFactory.createXYLineChart(title, "X", "Y",
            XYDatasetGenerator.generateXYDataset(data.csvData));
    final XYPlot xyPlot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesStroke(0, new BasicStroke(3f));
    renderer.setSeriesLinesVisible(0, true);
    renderer.setSeriesShapesVisible(0, false);
    renderer.setSeriesLinesVisible(1, false);
    renderer.setSeriesShapesVisible(1, true);
    Shape cross = ShapeUtilities.createDiagonalCross(2f, 0.5f);
    renderer.setSeriesShape(1, cross);/*from ww  w.  j  a v  a  2 s.  c om*/
    xyPlot.setRenderer(renderer);
    xyPlot.setQuadrantOrigin(new Point(0, 0));

    int i = 0;
    for (Double[] csvRow : data.csvData) {
        if (i % 20 == 1) {
            final XYTextAnnotation annotation = new XYTextAnnotation(Double.toString(csvRow[3]), csvRow[0],
                    csvRow[1]);
            annotation.setFont(new Font("SansSerif", Font.PLAIN, 10));
            xyPlot.addAnnotation(annotation);
        }
        i++;
    }

    int width = (int) Math.round(data.maxX - data.minX) + 50;
    int height = (int) Math.round(data.maxY - data.minY) + 50;
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(width, height));
    setContentPane(chartPanel);
    File XYChart = new File(FILE_PATH + "\\TurnMovementPlot.png");
    ChartUtilities.saveChartAsPNG(XYChart, chart, width, height);
}

From source file:net.sf.jasperreports.customizers.marker.CategoryMarkerCustomizer.java

protected CategoryMarker createMarker(JRChart jrc) {
    Comparable<?> value = getProperty(PROPERTY_CATEGORY);

    if (value == null) {
        return null;
    }/* w w  w  .  j  a  v a2 s . c o m*/

    CategoryMarker marker = new CategoryMarker(value);

    configureMarker(marker);

    configureStroke(marker);

    Boolean drawAsLine = getBooleanProperty(PROPERTY_DRAW_AS_LINE);
    if (drawAsLine != null) {
        marker.setDrawAsLine(drawAsLine);
    }

    //Setup the font
    Font font = marker.getLabelFont();

    String fontName = getProperty(PROPERTY_FONT_NAME);
    if (fontName == null) {
        fontName = font.getName();
    }

    Float fontSize = getFloatProperty(PROPERTY_FONT_SIZE);
    if (fontSize == null) {
        fontSize = Float.valueOf(font.getSize());
    }

    int fontStyle = Font.PLAIN;
    Boolean isBold = getBooleanProperty(PROPERTY_FONT_BOLD);
    if (isBold != null) {
        fontStyle = fontStyle | Font.BOLD;
    }
    Boolean isItalic = getBooleanProperty(PROPERTY_FONT_ITALIC);
    if (isItalic != null) {
        fontStyle = fontStyle | Font.ITALIC;
    }

    marker.setLabelFont(FontUtil.getInstance(filler.getJasperReportsContext()).getAwtFontFromBundles(fontName,
            fontStyle, fontSize, filler.getFillContext().getMasterLocale(), true));

    return marker;
}

From source file:motordrivertxrx.View.MainView.java

/**
 * Creates new form MainView/*from w  w  w . j a v  a2s  .co  m*/
 */
public MainView() {
    initComponents();

    this.dataset1 = new DefaultValueDataset(10.0);
    this.dataset2 = new DefaultValueDataset(50.0);

    // get data for diagrams
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);
    plot.setDataset(0, this.dataset1);
    plot.setDataset(1, this.dataset2);
    SimpleDialFrame dialFrame = new SimpleDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.DARK_GRAY);
    plot.setDialFrame(dialFrame);
    /*
    GradientPaint gp = new GradientPaint(new Point(), 
        new Color(255, 255, 255), new Point(), 
        new Color(170, 170, 220));
    */
    GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), Color.ORANGE);

    DialBackground db = new DialBackground(gp);
    db.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    plot.setBackground(db);

    DialTextAnnotation annotation1 = new DialTextAnnotation("Velocidad");
    annotation1.setFont(new Font("Dialog", Font.BOLD, 14));
    annotation1.setRadius(0.7);

    plot.addLayer(annotation1);

    DialValueIndicator dvi = new DialValueIndicator(0, "c");
    dvi.setFont(new Font("Dialog", Font.PLAIN, 10));
    dvi.setOutlinePaint(Color.darkGray);
    dvi.setRadius(0.60);
    dvi.setAngle(-103.0);
    plot.addLayer(dvi);

    DialValueIndicator dvi2 = new DialValueIndicator(1, "c");
    dvi2.setFont(new Font("Dialog", Font.PLAIN, 10));
    dvi2.setOutlinePaint(Color.red);
    dvi2.setRadius(0.60);
    dvi2.setAngle(-77.0);
    plot.addLayer(dvi2);

    StandardDialScale scale = new StandardDialScale(0, 127, -120, -300);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14));
    plot.addScale(0, scale);

    StandardDialScale scale2 = new StandardDialScale(0, 100, -120, -300);
    scale2.setTickRadius(0.50);
    scale2.setTickLabelOffset(0.15);
    scale2.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10));
    scale2.setMajorTickPaint(Color.red);
    plot.addScale(1, scale2);
    plot.mapDatasetToScale(1, 1);

    DialPointer needle2 = new DialPointer.Pin(1);
    needle2.setRadius(0.55);
    plot.addLayer(needle2);

    DialPointer needle = new DialPointer.Pointer(0);
    plot.addLayer(needle);

    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    plot.setCap(cap);

    JFreeChart chart1 = new JFreeChart(plot);
    chart1.setTitle("Velocidad motor");
    ChartPanel cp1 = new ChartPanel(chart1);
    cp1.setPreferredSize(new Dimension(400, 400));

    /*JPanel sliderPanel = new JPanel(new GridLayout(2, 2));
    sliderPanel.add(new JLabel("Outer Needle:"));
    sliderPanel.add(new JLabel("Inner Needle:"));
    this.slider1 = new JSlider(-40, 60);
    this.slider1.setMajorTickSpacing(20);
    this.slider1.setPaintTicks(true);
    this.slider1.setPaintLabels(true);
    this.slider1.addChangeListener(this);
    sliderPanel.add(this.slider1);
    sliderPanel.add(this.slider1);
    this.slider2 = new JSlider(0, 100);
    this.slider2.setMajorTickSpacing(20);
    this.slider2.setPaintTicks(true);
    this.slider2.setPaintLabels(true);
    this.slider2.addChangeListener(this);
    sliderPanel.add(this.slider2);*/

    velocimetroPanel.add(cp1);

}