Example usage for java.awt Color YELLOW

List of usage examples for java.awt Color YELLOW

Introduction

In this page you can find the example usage for java.awt Color YELLOW.

Prototype

Color YELLOW

To view the source code for java.awt Color YELLOW.

Click Source Link

Document

The color yellow.

Usage

From source file:fll.subjective.SubjectiveFrame.java

private void createSubjectiveTable(final JTabbedPane tabbedPane, final ScoreCategory subjectiveCategory) {
    final SubjectiveTableModel tableModel = new SubjectiveTableModel(_scoreDocument, subjectiveCategory,
            _schedule, _scheduleColumnMappings);
    final JTable table = new JTable(tableModel);
    table.setDefaultRenderer(Date.class, DateRenderer.INSTANCE);

    // Make grid lines black (needed for Mac)
    table.setGridColor(Color.BLACK);

    // auto table sorter
    table.setAutoCreateRowSorter(true);/*from w  w  w.  j  a v a2  s  .  c  o  m*/

    final String title = subjectiveCategory.getTitle();
    _tables.put(title, table);
    final JScrollPane tableScroller = new JScrollPane(table);
    tableScroller.setPreferredSize(new Dimension(640, 480));
    tabbedPane.addTab(title, tableScroller);

    table.setSelectionBackground(Color.YELLOW);

    setupTabReturnBehavior(table);

    int goalIndex = 0;
    for (final AbstractGoal goal : subjectiveCategory.getGoals()) {
        final TableColumn column = table.getColumnModel()
                .getColumn(goalIndex + tableModel.getNumColumnsLeftOfScores());
        if (goal.isEnumerated()) {
            final Vector<String> posValues = new Vector<String>();
            posValues.add("");
            for (final EnumeratedValue posValue : goal.getSortedValues()) {
                posValues.add(posValue.getTitle());
            }

            column.setCellEditor(new DefaultCellEditor(new JComboBox<String>(posValues)));
        } else {
            final JTextField editor = new SelectTextField();
            column.setCellEditor(new DefaultCellEditor(editor));
        }
        ++goalIndex;
    }
}

From source file:edu.unibonn.kmeans.mapreduce.plotting.TimeSeriesPlotter_KMeans.java

private Paint getColor(int color_number) {
    Color curr_color = null;//w  w w  .j  ava 2s  .  c  om

    switch (color_number) {
    case 0:
        curr_color = Color.BLUE;
        break;
    case 1:
        curr_color = Color.GREEN;
        break;
    case 2:
        curr_color = Color.RED;
        break;
    case 3:
        curr_color = Color.PINK;
        break;
    case 4:
        curr_color = Color.MAGENTA;
        break;
    case 5:
        curr_color = Color.CYAN;
        break;
    case 6:
        curr_color = Color.DARK_GRAY;
        break;
    case 7:
        curr_color = Color.LIGHT_GRAY;
        break;
    case 8:
        curr_color = Color.YELLOW;
        break;
    case 9:
        curr_color = Color.ORANGE;
        break;
    case 10:
        curr_color = Color.BLACK;
        break;
    //           case 11: curr_color = Color.YELLOW;
    //                    break;
    //           case 12: curr_color = Color.BLACK;
    //                    break;
    //           case 13: curr_color = Color.BLACK;
    //                  break;
    //           case 14: curr_color = Color.BLACK;
    //                  break;
    //           case 15: curr_color = Color.BLACK;
    //                break;
    //           case 16: curr_color = Color.BLACK;
    //                break;
    //           case 17: curr_color = Color.BLACK;
    //                break;
    //           case 18: curr_color = Color.BLACK;
    //                break;
    //           case 20: curr_color = Color.BLACK;
    //                break;
    //           case 21: curr_color = Color.BLACK;
    //                break;
    //           case 22: curr_color = Color.BLACK;
    //                break;
    //           case 23: curr_color = Color.BLACK;
    //                break;
    default:
        curr_color = Color.WHITE;
        break;
    }

    return curr_color;
}

From source file:op.care.nursingprocess.PnlNursingProcess.java

private JPanel createNPPanel(final NursingProcess np) {
    /***//  www. j  a v  a 2  s  .c o  m
     *                          _        ____ ____  _  _     _   _ ____
     *       ___ _ __ ___  __ _| |_ ___ / ___|  _ \| || |   | \ | |  _ \
     *      / __| '__/ _ \/ _` | __/ _ \ |   | |_) | || |_  |  \| | |_) |
     *     | (__| | |  __/ (_| | ||  __/ |___|  __/|__   _| | |\  |  __/
     *      \___|_|  \___|\__,_|\__\___|\____|_|      |_|   |_| \_|_|
     *
     */
    if (!contenPanelMap.containsKey(np)) {
        String title = "<html><table border=\"0\">";

        if (!np.getCommontags().isEmpty()) {
            title += "<tr>" + "    <td colspan=\"2\">"
                    + CommontagsTools.getAsHTML(np.getCommontags(), SYSConst.html_16x16_tagPurple_internal)
                    + "</td>" + "  </tr>";
        }

        title += "<tr valign=\"top\">" + "<td width=\"280\" align=\"left\">" + np.getPITAsHTML() + "</td>"
                + "<td width=\"500\" align=\"left\">" + (np.isClosed() ? "<s>" : "") + np.getContentAsHTML()
                + (np.isClosed() ? "</s>" : "") + "</td></tr>";
        title += "</table>" + "</html>";

        DefaultCPTitle cptitle = new DefaultCPTitle(title, null);
        cptitle.getButton().setVerticalTextPosition(SwingConstants.TOP);

        if (!np.getAttachedFilesConnections().isEmpty()) {
            /***
             *      _     _         _____ _ _
             *     | |__ | |_ _ __ |  ___(_) | ___  ___
             *     | '_ \| __| '_ \| |_  | | |/ _ \/ __|
             *     | |_) | |_| | | |  _| | | |  __/\__ \
             *     |_.__/ \__|_| |_|_|   |_|_|\___||___/
             *
             */
            final JButton btnFiles = new JButton(Integer.toString(np.getAttachedFilesConnections().size()),
                    SYSConst.icon22greenStar);
            btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip"));
            btnFiles.setForeground(Color.BLUE);
            btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER);
            btnFiles.setFont(SYSConst.ARIAL18BOLD);
            btnFiles.setPressedIcon(SYSConst.icon22Pressed);
            btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT);
            btnFiles.setAlignmentY(Component.TOP_ALIGNMENT);
            btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnFiles.setContentAreaFilled(false);
            btnFiles.setBorder(null);
            btnFiles.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    Closure fileHandleClosure = np.isClosed() ? null : new Closure() {
                        @Override
                        public void execute(Object o) {
                            EntityManager em = OPDE.createEM();
                            final NursingProcess myNP = em.find(NursingProcess.class, np.getID());
                            em.close();
                            // Refresh Display
                            valuecache.get(np.getCategory()).remove(np);
                            contenPanelMap.remove(np);
                            valuecache.get(myNP.getCategory()).add(myNP);
                            Collections.sort(valuecache.get(myNP.getCategory()));

                            createCP4(myNP.getCategory());
                            buildPanel();
                        }
                    };
                    new DlgFiles(np, fileHandleClosure);
                }
            });
            btnFiles.setEnabled(OPDE.isFTPworking());
            cptitle.getRight().add(btnFiles);
        }

        if (!np.getAttachedQProcessConnections().isEmpty()) {
            /***
             *      _     _         ____
             *     | |__ | |_ _ __ |  _ \ _ __ ___   ___ ___  ___ ___
             *     | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __|
             *     | |_) | |_| | | |  __/| | | (_) | (_|  __/\__ \__ \
             *     |_.__/ \__|_| |_|_|   |_|  \___/ \___\___||___/___/
             *
             */
            final JButton btnProcess = new JButton(Integer.toString(np.getAttachedQProcessConnections().size()),
                    SYSConst.icon22redStar);
            btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip"));
            btnProcess.setForeground(Color.YELLOW);
            btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER);
            btnProcess.setFont(SYSConst.ARIAL18BOLD);
            btnProcess.setPressedIcon(SYSConst.icon22Pressed);
            btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT);
            btnProcess.setAlignmentY(Component.TOP_ALIGNMENT);
            btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnProcess.setContentAreaFilled(false);
            btnProcess.setBorder(null);
            btnProcess.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    new DlgProcessAssign(np, new Closure() {
                        @Override
                        public void execute(Object o) {
                            if (o == null) {
                                return;
                            }
                            Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o;

                            ArrayList<QProcess> assigned = result.getFirst();
                            ArrayList<QProcess> unassigned = result.getSecond();

                            EntityManager em = OPDE.createEM();

                            try {
                                em.getTransaction().begin();

                                em.lock(em.merge(resident), LockModeType.OPTIMISTIC);
                                final NursingProcess myNP = em.merge(np);
                                em.lock(myNP, LockModeType.OPTIMISTIC_FORCE_INCREMENT);

                                ArrayList<SYSNP2PROCESS> attached = new ArrayList<SYSNP2PROCESS>(
                                        myNP.getAttachedQProcessConnections());
                                for (SYSNP2PROCESS linkObject : attached) {
                                    if (unassigned.contains(linkObject.getQProcess())) {
                                        linkObject.getQProcess().getAttachedNReportConnections()
                                                .remove(linkObject);
                                        linkObject.getNursingProcess().getAttachedQProcessConnections()
                                                .remove(linkObject);
                                        em.merge(new PReport(
                                                SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": "
                                                        + myNP.getTitle() + " ID: " + myNP.getID(),
                                                PReportTools.PREPORT_TYPE_REMOVE_ELEMENT,
                                                linkObject.getQProcess()));
                                        em.remove(linkObject);
                                    }
                                }
                                attached.clear();

                                for (QProcess qProcess : assigned) {
                                    java.util.List<QProcessElement> listElements = qProcess.getElements();
                                    if (!listElements.contains(myNP)) {
                                        QProcess myQProcess = em.merge(qProcess);
                                        SYSNP2PROCESS myLinkObject = em
                                                .merge(new SYSNP2PROCESS(myQProcess, myNP));
                                        em.merge(new PReport(
                                                SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": "
                                                        + myNP.getTitle() + " ID: " + myNP.getID(),
                                                PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess));
                                        qProcess.getAttachedNursingProcessesConnections().add(myLinkObject);
                                        myNP.getAttachedQProcessConnections().add(myLinkObject);
                                    }
                                }

                                em.getTransaction().commit();

                                // Refresh Display
                                valuecache.get(np.getCategory()).remove(np);
                                contenPanelMap.remove(np);
                                valuecache.get(myNP.getCategory()).add(myNP);
                                Collections.sort(valuecache.get(myNP.getCategory()));

                                createCP4(myNP.getCategory());
                                buildPanel();

                            } catch (OptimisticLockException ole) {
                                OPDE.warn(ole);
                                if (em.getTransaction().isActive()) {
                                    em.getTransaction().rollback();
                                }
                                if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) {
                                    OPDE.getMainframe().emptyFrame();
                                    OPDE.getMainframe().afterLogin();
                                } else {
                                    reloadDisplay();
                                }
                            } catch (RollbackException ole) {
                                if (em.getTransaction().isActive()) {
                                    em.getTransaction().rollback();
                                }
                                if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) {
                                    OPDE.getMainframe().emptyFrame();
                                    OPDE.getMainframe().afterLogin();
                                }
                                OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage());
                            } catch (Exception e) {
                                if (em.getTransaction().isActive()) {
                                    em.getTransaction().rollback();
                                }
                                OPDE.fatal(e);
                            } finally {
                                em.close();
                            }

                        }
                    });
                }
            });
            btnProcess.setEnabled(OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID));
            cptitle.getRight().add(btnProcess);
        }

        if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.PRINT, internalClassID)) {
            /***
             *      _     _         ____       _       _
             *     | |__ | |_ _ __ |  _ \ _ __(_)_ __ | |_
             *     | '_ \| __| '_ \| |_) | '__| | '_ \| __|
             *     | |_) | |_| | | |  __/| |  | | | | | |_
             *     |_.__/ \__|_| |_|_|   |_|  |_|_| |_|\__|
             *
             */
            JButton btnPrint = new JButton(SYSConst.icon22print2);
            btnPrint.setContentAreaFilled(false);
            btnPrint.setBorder(null);
            btnPrint.setPressedIcon(SYSConst.icon22print2Pressed);
            btnPrint.setAlignmentX(Component.RIGHT_ALIGNMENT);
            btnPrint.setAlignmentY(Component.TOP_ALIGNMENT);
            btnPrint.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    SYSFilesTools.print(NursingProcessTools.getAsHTML(np, true, true, true, true), true);
                }
            });

            cptitle.getRight().add(btnPrint);
            //                cptitle.getTitleButton().setVerticalTextPosition(SwingConstants.TOP);
        }

        /***
         *      __  __
         *     |  \/  | ___ _ __  _   _
         *     | |\/| |/ _ \ '_ \| | | |
         *     | |  | |  __/ | | | |_| |
         *     |_|  |_|\___|_| |_|\__,_|
         *
         */
        final JButton btnMenu = new JButton(SYSConst.icon22menu);
        btnMenu.setPressedIcon(SYSConst.icon22Pressed);
        btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnMenu.setAlignmentY(Component.TOP_ALIGNMENT);
        btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnMenu.setContentAreaFilled(false);
        btnMenu.setBorder(null);
        btnMenu.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                JidePopup popup = new JidePopup();
                popup.setMovable(false);
                popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS));
                popup.setOwner(btnMenu);
                popup.removeExcludedComponent(btnMenu);
                JPanel pnl = getMenu(np);
                popup.getContentPane().add(pnl);
                popup.setDefaultFocusComponent(pnl);

                GUITools.showPopup(popup, SwingConstants.WEST);
            }
        });

        btnMenu.setEnabled(!np.isClosed());
        cptitle.getButton().setIcon(getIcon(np));

        cptitle.getRight().add(btnMenu);
        cptitle.getMain().setBackground(getColor(np.getCategory())[SYSConst.light2]);
        cptitle.getMain().setOpaque(true);
        contenPanelMap.put(np, cptitle.getMain());
    }

    return contenPanelMap.get(np);
}

From source file:edworld.pdfreader4humans.PDFReader.java

private Color marginColor(Color inkColor) {
    return new Color(Color.YELLOW.getRGB() ^ inkColor.getRGB());
}

From source file:de.tor.tribes.ui.panels.MinimapPanel.java

@Override
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    try {//from w  ww.ja  v a 2 s  .c  om
        Graphics2D g2d = (Graphics2D) g;
        g2d.clearRect(0, 0, getWidth(), getHeight());
        g2d.drawImage(mBuffer, 0, 0, null);

        if (iCurrentView == ID_MINIMAP) {
            g2d.setColor(Color.YELLOW);

            int mapWidth = rVisiblePart.width;
            int mapHeight = rVisiblePart.height;

            int w = (int) Math.rint(((double) getWidth() / mapWidth) * (double) iWidth);
            int h = (int) Math.rint(((double) getHeight() / mapHeight) * (double) iHeight);

            double posX = ((double) getWidth() / mapWidth * (double) (iX - rVisiblePart.x)) - w / 2;
            double posY = ((double) getHeight() / mapHeight * (double) (iY - rVisiblePart.y)) - h / 2;

            g2d.drawRect((int) Math.rint(posX), (int) Math.rint(posY), w, h);

            if (iCurrentCursor == ImageManager.CURSOR_SHOT) {
                if (rDrag != null) {
                    g2d.setColor(Color.ORANGE);
                    g2d.drawRect((int) rDrag.getMinX(), (int) rDrag.getMinY(),
                            (int) (rDrag.getWidth() - rDrag.getX()), (int) (rDrag.getHeight() - rDrag.getY()));
                }
            } else if (iCurrentCursor == ImageManager.CURSOR_ZOOM) {
                if (rDrag != null) {
                    g2d.setColor(Color.CYAN);
                    g2d.drawRect((int) rDrag.getX(), (int) rDrag.getY(),
                            (int) (rDrag.getWidth() - rDrag.getX()),
                            (int) ((rDrag.getWidth() - rDrag.getX()) * ((double) getHeight()) / getWidth()));
                }
            }
        }

        if (showControls) {
            //g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .2f));
            Rectangle r = minimapButtons.get(ID_MINIMAP);
            g2d.setColor(Color.WHITE);
            Point menuPos = r.getLocation();
            menuPos.translate(-2, -2);
            //draw border
            g2d.fillRect(menuPos.x, menuPos.y, 88, 30);
            g2d.setColor(Color.BLACK);
            //check if mouse is inside minimap button
            if (getMousePosition() != null && r.contains(getMousePosition())) {
                g2d.setColor(Color.YELLOW);
                g2d.fillRect(r.x, r.y, r.width, r.height);
                g2d.setColor(Color.BLACK);
            }
            g2d.drawImage(minimapIcons.get(ID_MINIMAP), r.x, r.y, null);
            g2d.drawRect(r.x, r.y, r.width, r.height);

            r = minimapButtons.get(ID_ALLY_CHART);
            //check if mouse is inside ally chart button
            if (getMousePosition() != null && r.contains(getMousePosition())) {
                g2d.setColor(Color.YELLOW);
                g2d.fillRect(r.x, r.y, r.width, r.height);
                g2d.setColor(Color.BLACK);
            }
            g2d.drawImage(minimapIcons.get(ID_ALLY_CHART), r.x, r.y, null);
            g2d.drawRect(r.x, r.y, r.width, r.height);

            r = minimapButtons.get(ID_TRIBE_CHART);
            //check if mouse is inside tribe chart button
            if (getMousePosition() != null && r.contains(getMousePosition())) {
                g2d.setColor(Color.YELLOW);
                g2d.fillRect(r.x, r.y, r.width, r.height);
                g2d.setColor(Color.BLACK);

            }
            g2d.drawImage(minimapIcons.get(ID_TRIBE_CHART), r.x, r.y, null);
            g2d.drawRect(r.x, r.y, r.width, r.height);
        }
        g2d.dispose();
    } catch (Exception e) {
        logger.error("Failed painting Minimap", e);
    }
}

From source file:knop.psfj.BeadFrameList.java

/**
 * Gets the bead montage of the bead contained inside the list.
 *
 * @return the bead montage//from w  w w.j a v  a2s  .c om
 */
public ImageProcessor getBeadMontage() {

    if (size() == 0)
        return new ColorProcessor(10, 10);

    int lines = MathUtils.round(Math.sqrt(size()));
    int columns = lines;

    int fw = get(0).getWidth();
    int fh = get(0).getHeight();

    int w = get(0).getWidth() * lines;
    int h = get(0).getHeight() * lines;

    ColorProcessor montage = new ColorProcessor(w, h);

    int count = 0;

    for (int l = 0; l != lines; l++) {
        for (int c = 0; c != columns; c++) {
            montage.copyBits(get(count).getOverlayWithAlterEgo(), c * fw, l * fh, Blitter.COPY);
            montage.setColor(Color.yellow.darker().darker().darker().darker());
            montage.drawRect(c * fw, l * fh, fw, fh);
            count++;
            if (count >= size())
                break;
        }
        if (count >= size())
            break;
    }

    return montage;

}

From source file:projekt.CustomRenderer.java

public void raport_globalny() throws IOException, ClassNotFoundException, SQLException {
    String zapytanie = "select count(*) as Aktualne from zadania where Status_zadania='Aktualne'";
    String zapytanie1 = "select count(*) as FORTEST from zadania where Status_zadania='FORTEST'";
    String zapytanie2 = "select count(*) as Zakonczone from zadania where Status_zadania='Zakonczone'";

    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pz?characterEncoding=utf8",
            "root", "");
    PreparedStatement statment;/* w w  w .j a v  a  2 s. co  m*/
    ResultSet result;
    double odp = 0, odp1 = 0, odp2 = 0;
    statment = con.prepareStatement(zapytanie);
    result = statment.executeQuery();
    if (result.next()) {
        odp = result.getDouble("Aktualne");
    }
    statment = con.prepareStatement(zapytanie1);
    result = statment.executeQuery();
    if (result.next()) {
        odp1 = result.getDouble("FORTEST");
    }
    statment = con.prepareStatement(zapytanie2);
    result = statment.executeQuery();
    if (result.next()) {
        odp2 = result.getDouble("Zakonczone");
    }
    loginController login = new loginController();
    statment = con.prepareStatement(
            "SELECT CONCAT(imie, ' ', nazwisko) as osoba from uzytkownicy WHERE idUzytkownika = '"
                    + login.uzytkownikID + "'");
    result = statment.executeQuery();
    String bbc = "";
    if (result.next()) {
        bbc = result.getString(1);
    }

    DefaultCategoryDataset set2 = new DefaultCategoryDataset();
    set2.setValue(odp, "", "Aktualne");
    set2.setValue(odp1, "", "FORTEST");
    set2.setValue(odp2, "", "Zakonczone");
    JFreeChart chart = ChartFactory.createBarChart("Wszystkie zadania w bazie", "Zadania", "Ilosc", set2,
            PlotOrientation.VERTICAL, false, true, false);

    final CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.red, Color.blue, Color.green,
            Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue });

    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setNoDataMessage("NO DATA!");

    renderer.setItemLabelsVisible(true);
    final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
            TextAnchor.CENTER, 45.0);
    renderer.setPositiveItemLabelPosition(p);
    plot.setRenderer(renderer);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ChartUtilities.writeChartAsJPEG(out, chart, 450, 600);
    DateFormat dataformat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    DateFormat dataformat1 = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
    Date data = new Date();
    String fileName = "Raport globalny " + dataformat1.format(data) + ".pdf";
    try {
        PDRectangle PAGE_SIZE = PDRectangle.A4;
        PDDocument doc = new PDDocument();
        PDFont font = PDType0Font.load(doc,
                getClass().getResourceAsStream("/fonts/RobotoCondensed-Regular.ttf"));
        PDFont font1 = PDType0Font.load(doc, getClass().getResourceAsStream("/fonts/RobotoCondensed-Bold.ttf"));
        PDPage page = new PDPage(PAGE_SIZE);
        PDPage page1 = new PDPage(PAGE_SIZE);
        doc.addPage(page);
        PDPageContentStream content = new PDPageContentStream(doc, page);
        //naglowek strona 1
        Naglowek(content, dataformat, data);
        //stopka strona1
        Stopka(content, doc);
        content.beginText();
        content.setFont(font1, 48);
        content.moveTextPositionByAmount(135, 550);
        content.showText("Raport globalny");
        content.endText();

        content.beginText();
        content.setFont(font, 22);
        content.moveTextPositionByAmount(30, 250);
        content.showText("Wersja systemu : 1.0");
        content.newLine();
        content.moveTextPositionByAmount(0, 35);
        content.showText("Autor raportu : " + result.getString("osoba"));
        content.endText();
        content.close();

        PDPageContentStream content1 = new PDPageContentStream(doc, page1);

        PDPage page2 = new PDPage(PAGE_SIZE);
        doc.addPage(page2);
        PDPageContentStream content2 = new PDPageContentStream(doc, page2);
        Naglowek(content2, dataformat, data);
        //stopka strona2
        Stopka(content2, doc);
        content2.beginText();
        content2.setFont(font, 14);
        content2.moveTextPositionByAmount(30, 775);
        content2.showText("Wszystkie projekty z bazy danych:");
        statment = con.prepareStatement("Select Nazwa, Opis, Poczatek, Koniec, ludzie from projekty");
        result = statment.executeQuery();
        content2.newLine();
        int liczba = 615;
        content2.moveTextPositionByAmount(0, -15);
        while (result.next()) {
            content2.newLine();
            content2.moveTextPositionByAmount(0, -22);
            liczba += 22;
            //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec"));

            content2.showText("Nazwa : " + result.getString("Nazwa") + " Opis: " + result.getString("Opis"));
            content2.newLine();
            content2.moveTextPositionByAmount(0, -17);
            liczba += 22;
            content2.showText("Data rozpoczecia: " + result.getString("Poczatek") + " Data zakonczenia: "
                    + result.getString("Koniec"));

        }
        content2.endText();
        //          content2.setLineWidth(2);
        //        content2.moveTo(10, liczba + 5);
        //        content2.lineTo(10, liczba +5);
        //        content2.closeAndStroke();
        DateFormat dataformat2 = new SimpleDateFormat("yyyy-MM-dd");
        statment = con.prepareStatement("Select count(*) as 'Aktualne' from projekty where Koniec > '"
                + dataformat2.format(data) + "'");
        result = statment.executeQuery();
        int aktualne = 0, zakonczone = 0;
        if (result.next()) {
            aktualne = result.getInt("Aktualne");
        }
        System.out.println("aktualne:" + aktualne);
        statment = con.prepareStatement("Select count(*) as 'Zakonczone' from projekty where Koniec < '"
                + dataformat2.format(data) + "'");
        result = statment.executeQuery();
        if (result.next()) {
            zakonczone = result.getInt("Zakonczone");
        }
        System.out.println("zakonczone:" + zakonczone);
        DefaultPieDataset pieDataset = new DefaultPieDataset();
        pieDataset.setValue("Aktualne", aktualne);
        pieDataset.setValue("Zakonczone", zakonczone);
        JFreeChart chart1 = ChartFactory.createPieChart("Zestawienia projektw", // Title
                pieDataset, // Dataset
                true, // Show legend
                true, // Use tooltips
                false // Configure chart to generate URLs?
        );

        PiePlot plot1 = (PiePlot) chart1.getPlot();
        plot1.setSectionPaint("Aktualne", Color.green);
        plot1.setSectionPaint("Zakonczone", Color.red);
        plot1.setExplodePercent("Aktualne", 0.10);
        plot1.setSimpleLabels(true);

        PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})",
                new DecimalFormat("0"), new DecimalFormat("0%"));
        plot1.setLabelGenerator(gen);

        ByteArrayOutputStream out1 = new ByteArrayOutputStream();
        ChartUtilities.writeChartAsJPEG(out1, chart1, 450, 600);
        PDImageXObject img1 = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out1.toByteArray()));

        content2.close();
        PDPage page3 = new PDPage(PAGE_SIZE);
        doc.addPage(page3);
        PDPageContentStream content3 = new PDPageContentStream(doc, page3);
        Naglowek(content3, dataformat, data);
        //stopka strona2
        Stopka(content3, doc);
        content3.drawImage(img1, 50, 50);
        content3.close();
        PDPage page4 = new PDPage(PAGE_SIZE);
        doc.addPage(page4);
        PDPageContentStream content4 = new PDPageContentStream(doc, page4);
        Naglowek(content4, dataformat, data);
        //stopka strona2
        Stopka(content4, doc);
        content4.beginText();
        content4.setFont(font, 14);
        content4.moveTextPositionByAmount(30, 780);
        content4.showText("Wszystkie zadania w bazie:");
        statment = con.prepareStatement(
                "SELECT `Nazwa`,`Opis`,`Status_zadania`,`projekt`, CONCAT(x.imie, \" \", x.nazwisko) as \"UZY\" FROM `zadania` , (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) X WHERE zadania.idUzytkownika=x.idUzytkownika limit 12");
        result = statment.executeQuery();
        content4.newLine();
        int nw = 850;
        content4.moveTextPositionByAmount(0, -15);
        nw -= 15;
        while (result.next()) {
            content4.newLine();
            nw -= 22;
            content4.moveTextPositionByAmount(0, -22);
            //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec"));
            content4.showText("Nazwa : " + result.getString("Nazwa"));
            content4.newLine();
            nw -= 17;
            content4.moveTextPositionByAmount(0, -17);
            content4.showText(" Opis: " + result.getString("Opis") + " Status zadania: "
                    + result.getString("Status_zadania"));
            content4.newLine();
            nw -= 17;
            content4.moveTextPositionByAmount(0, -17);
            content4.showText(" Projekt: " + result.getString("projekt") + " Przydzielona osoba do zadania: "
                    + result.getString("UZY"));

        }

        content4.endText();
        content4.close();
        statment = con.prepareStatement("SELECT count(*) as 'liczba' FROM `zadania`");
        result = statment.executeQuery();
        if (result.next()) {
        }
        statment = con.prepareStatement(
                "SELECT `Nazwa`,`Opis`,`Status_zadania`,`projekt`, CONCAT(x.imie, \" \", x.nazwisko) as \"UZY\" FROM `zadania` , (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) X WHERE zadania.idUzytkownika=x.idUzytkownika limit 12,"
                        + result.getInt(1) + "");
        result = statment.executeQuery();
        PDPage page5 = new PDPage(PAGE_SIZE);
        doc.addPage(page5);
        PDPageContentStream content5 = new PDPageContentStream(doc, page5);
        Naglowek(content5, dataformat, data);
        //stopka strona2
        Stopka(content5, doc);
        content5.beginText();
        content5.setFont(font, 14);
        content5.moveTextPositionByAmount(30, 700);
        while (result.next()) {
            content5.newLine();
            nw -= 22;
            content5.moveTextPositionByAmount(0, -22);
            //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec"));
            content5.showText("Nazwa : " + result.getString("Nazwa"));
            content5.newLine();
            nw -= 17;
            content5.moveTextPositionByAmount(0, -17);
            content5.showText(" Opis: " + result.getString("Opis") + " Status zadania: "
                    + result.getString("Status_zadania"));
            content5.newLine();
            nw -= 17;
            content5.moveTextPositionByAmount(0, -17);
            content5.showText(" Projekt: " + result.getString("projekt") + " Przydzielona osoba do zadania: "
                    + result.getString("UZY"));
        }
        content5.endText();
        content5.close();
        doc.addPage(page1);
        //naglowek strona 2
        Naglowek(content1, dataformat, data);
        //stopka strona2
        Stopka(content1, doc);
        PDImageXObject img = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out.toByteArray()));
        content1.drawImage(img, 50, 50);
        content1.close();
        doc.save(fileName);
        doc.close();

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
}

From source file:com.juanhg.pot.PotApplet.java

void updateOutputs() {

    double Wo = model.getWo();
    double Wf = model.getWf();
    double Qo = model.getQo();
    double Qf = model.getQf();
    double To = model.getTo();
    double Tf = model.getTf();
    double Uo = model.getUo();
    double Uf = model.getUf();
    double Po = model.getPo();
    double Pf = model.getPf();
    double Vo = model.getVo();
    double Vf = model.getVf();
    double aux;//from   www  .  ja v a 2 s.c om

    if (Wo > Wf) {
        aux = Wo;
        Wo = Wf;
        Wf = aux;
    }
    if (Qo > Qf) {
        aux = Qo;
        Qo = Qf;
        Qf = aux;
    }
    if (To > Tf) {
        aux = To;
        To = Tf;
        Tf = aux;
    }
    if (Uo > Uf) {
        aux = Uo;
        Uo = Uf;
        Uf = aux;
    }
    if (Po > Pf) {
        aux = Po;
        Po = Pf;
        Pf = aux;
    }
    if (Vo > Vf) {
        aux = Vo;
        Vo = Vf;
        Vf = aux;
    }

    double Wn = normalize(model.getW(), Wo, Wf, 0, 10);
    double Qn = normalize(model.getQ(), Qo, Qf, 0, 10);
    double Tn = normalize(model.getT(), To, Tf, 0, 10);
    double Un = normalize(model.getU(), Uo, Uf, 0, 10);
    double Pn = normalize(model.getP(), Po, Pf, 0, 10);
    double Vn = normalize(model.getV(), Vo, Vf, 0, 10);

    Stroke stroke = new BasicStroke(1f);
    chartChart.deleteAnnotation(WAnnotation);
    WAnnotation = chartChart.drawBox(0.5, 0, 1.5, Wn, stroke, Color.BLACK, Color.RED);
    chartChart.deleteAnnotation(QAnnotation);
    QAnnotation = chartChart.drawBox(2.5, 0, 3.5, Qn, stroke, Color.BLACK, Color.ORANGE);
    chartChart.deleteAnnotation(TAnnotation);
    TAnnotation = chartChart.drawBox(4.5, 0, 5.5, Tn, stroke, Color.BLACK, Color.YELLOW);
    chartChart.deleteAnnotation(UAnnotation);
    UAnnotation = chartChart.drawBox(6.5, 0, 7.5, Un, stroke, Color.BLACK, Color.GREEN);
    chartChart.deleteAnnotation(PAnnotation);
    PAnnotation = chartChart.drawBox(8.5, 0, 9.5, Pn, stroke, Color.BLACK, Color.BLUE);
    chartChart.deleteAnnotation(VAnnotation);
    VAnnotation = chartChart.drawBox(10.5, 0, 11.5, Vn, stroke, Color.BLACK, Color.MAGENTA);
}

From source file:javazoom.jlgui.player.amp.visual.ui.SpectrumTimeAnalyzer.java

public synchronized void process(float[] pLeft, float[] pRight, float pFrameRateRatioHint) {
    if (displayMode == DISPLAY_MODE_OFF)
        return;//from   w ww .  j a  v  a  2s.  co  m
    Graphics wGrp = getDoubleBuffer().getGraphics();
    wGrp.setColor(getBackground());
    wGrp.fillRect(0, 0, getSize().width, getSize().height);
    switch (displayMode) {
    case DISPLAY_MODE_SCOPE:
        drawScope(wGrp, stereoMerge(pLeft, pRight));
        break;
    case DISPLAY_MODE_SPECTRUM_ANALYSER:
        drawSpectrumAnalyser(wGrp, stereoMerge(pLeft, pRight), pFrameRateRatioHint);
        break;
    case DISPLAY_MODE_OFF:
        drawVUMeter(wGrp, pLeft, pRight, pFrameRateRatioHint);
        break;
    }
    // -- Show FPS if necessary.
    if (showFPS) {
        // -- Calculate FPS.
        if (System.currentTimeMillis() >= lfu + 1000) {
            lfu = System.currentTimeMillis();
            fps = fc;
            fc = 0;
        }
        fc++;
        wGrp.setColor(Color.yellow);
        wGrp.drawString("FPS: " + fps + " (FRRH: " + pFrameRateRatioHint + ")", 0, height - 1);
    }
    if (getGraphics() != null)
        getGraphics().drawImage(getDoubleBuffer(), 0, 0, null);
    //      repaint();
    //      try {
    //          EventQueue.invokeLater( new AWTPaintSynchronizer() );
    //      } catch ( Exception pEx ) {
    //          // -- Ignore exception.
    //          pEx.printStackTrace();
    //      }
}

From source file:com.viettel.util.excel.DynamicExport.java

public void setCellFormat(int r1, int c1, int r2, int c2, int formatType) throws CellException {
    CellFormat format = view.getCellFormat(r1, c1, r2, c2);
    if (formatType == HEADER_FORMAT) {
        // <editor-fold defaultstate="collapsed" desc="Header cua bang">
        short border = CellFormat.BorderThin;
        format.setLeftBorder(border);//w w  w. ja v  a  2 s . c  o  m
        format.setRightBorder(border);
        format.setTopBorder(border);
        format.setBottomBorder(border);
        format.setHorizontalInsideBorder(border);
        format.setVerticalInsideBorder(border);

        Color borderColor = Color.GREEN.darker();
        format.setLeftBorderColor(borderColor);
        format.setRightBorderColor(borderColor);
        format.setTopBorderColor(borderColor);
        format.setBottomBorderColor(borderColor);

        format.setFontBold(true);
        format.setPattern((short) 1);
        format.setPatternFG(new Color(254, 252, 172));
        format.setWordWrap(true);

        format.setVerticalAlignment(CellFormat.VerticalAlignmentCenter);
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentCenter);
        // </editor-fold>
    } else if (formatType == BORDER_FORMAT) {
        // <editor-fold defaultstate="collapsed"
        // desc="Border cho du lieu binh thuong">
        short border = CellFormat.BorderThin;
        format.setLeftBorder(border);
        format.setRightBorder(border);
        format.setTopBorder(border);
        format.setBottomBorder(border);
        format.setHorizontalInsideBorder(border);
        format.setVerticalInsideBorder(border);

        Color borderColor = Color.GREEN.darker();
        format.setLeftBorderColor(borderColor);
        format.setRightBorderColor(borderColor);
        format.setTopBorderColor(borderColor);
        format.setBottomBorderColor(borderColor);

        // format.setFontBold(false);
        view.setRowHeightAuto(r1, c1, r2, c2, true);
        // view.setRowHeight(r1, r2, 200, true, true);
        format.setWordWrap(true);
        // </editor-fold>
    } else if (formatType == BORDER_FORMAT_NON_WRAP) {
        // <editor-fold defaultstate="collapsed"
        // desc="Border cho du lieu binh thuong">
        short border = CellFormat.BorderThin;
        format.setLeftBorder(border);
        format.setRightBorder(border);
        format.setTopBorder(border);
        format.setBottomBorder(border);
        format.setHorizontalInsideBorder(border);
        format.setVerticalInsideBorder(border);

        Color borderColor = Color.GREEN.darker();
        format.setLeftBorderColor(borderColor);
        format.setRightBorderColor(borderColor);
        format.setTopBorderColor(borderColor);
        format.setBottomBorderColor(borderColor);

        // format.setFontBold(false);
        format.setPattern((short) 1);
        // view.setRowHeightAuto(r1, c1, r2, c2, true);
        view.setRowHeight(r1, r2, 200, true, true);
        format.setWordWrap(false);
        // </editor-fold>
    } else if (formatType == BLACK_BORDER_FORMAT) {
        // <editor-fold defaultstate="collapsed"
        // desc="Border cho du lieu binh thuong">
        short border = CellFormat.BorderThin;
        format.setLeftBorder(border);
        format.setRightBorder(border);
        format.setTopBorder(border);
        format.setBottomBorder(border);
        format.setHorizontalInsideBorder(border);
        format.setVerticalInsideBorder(border);

        Color borderColor = Color.BLACK.darker();
        format.setLeftBorderColor(borderColor);
        format.setRightBorderColor(borderColor);
        format.setTopBorderColor(borderColor);
        format.setBottomBorderColor(borderColor);

        // format.setFontBold(false);
        format.setWordWrap(true);
        // </editor-fold>
    } else if (formatType == TITLE) {
        format.setFontBold(true);
        format.setPattern((short) 1);
        format.setPatternFG(Color.GREEN);
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentCenter);
    } else if (formatType == GROUP_LEVEL1_FORMAT) {
        format.setFontBold(true);
        format.setPattern((short) 1);
        format.setPatternFG(Color.ORANGE);
    } else if (formatType == GROUP_LEVEL2_FORMAT) {
        format.setFontBold(true);
        format.setFontItalic(true);
        format.setPattern((short) 1);
        format.setPatternFG(new Color(135, 206, 250));
    } else if (formatType == GROUP_LEVEL3_FORMAT) {
        format.setFontBold(true);
        format.setFontItalic(true);
        format.setPattern((short) 1);
        format.setPatternFG(new Color(10, 175, 255));
    } else if (formatType == GROUP_LEVEL4_FORMAT) {
        format.setFontBold(true);
        format.setFontItalic(true);
        format.setPattern((short) 1);
        format.setPatternFG(new Color(209, 232, 170));
    } else if (formatType == GROUP_LEVEL5_FORMAT) {
        format.setFontBold(true);
        format.setFontItalic(true);
        format.setPattern((short) 1);
        format.setPatternFG(new Color(250, 250, 210));
    } else if (formatType == GROUP_LEVEL6_FORMAT) {
        format.setFontBold(true);
        format.setFontItalic(true);
        format.setPattern((short) 1);
        format.setPatternFG(new Color(209, 238, 238));
    } else if (formatType == ACCOUNTING_FORMAT) {
        String numberFormat = "_(* #,##0_);_(* (#,##0);_(* \"-\"_);_(@_)";
        format.setCustomFormat(numberFormat);
    } else if (formatType == NUMBER_FORMAT) {
        String numberFormat = "#,##0";
        format.setCustomFormat(numberFormat);
    } else if (formatType == NUMBER_FORMAT_D) {
        String numberFormat = "#,##0.00";
        format.setCustomFormat(numberFormat);
    } else if (formatType == BOLD_WHITE) { // SonPN
        format.setFontBold(true);
        format.setPattern((short) 1);
        format.setPatternFG(Color.WHITE);
        // format.setHorizontalAlignment(CellFormat.HorizontalAlignmentLeft);
    } else if (formatType == CENTER_FORMAT) {
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentCenter);
    } else if (formatType == BOLD_CENTER_FORMAT) {
        format.setFontBold(true);
        format.setWordWrap(true);
        format.setVerticalAlignment((short) 1);
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentCenter);
    } else if (formatType == BOLD_FORMAT) {
        format.setFontBold(true);
    } else if (formatType == BOLD_WHITE_CENTER) { // SonPN
        format.setFontBold(true);
        format.setPattern((short) 1);
        // format.setPatternFG(Color.WHITE);
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentCenter);
    } else if (formatType == NOMARL_WHITE_CENTER) { // SonPN
        format.setFontBold(false);
        format.setPattern((short) 1);
        format.setPatternFG(Color.WHITE);
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentCenter);
    } else if (formatType == NORMAL_ITALIC) {
        format.setFontItalic(true);
    } else if (formatType == GROUP_DATA_FORMAT) {
        format.setPattern((short) 1);
        format.setPatternFG(Color.YELLOW);
    } else if (formatType == PERCENT_FORMAT) {
        format.setFontBold(true);
        // format.setFontItalic(true);
        format.setPattern((short) 1);
        // format.setPatternFG(new Color(209, 232, 170));
        String percentFormat = "#,##" + "%";
        format.setCustomFormat(percentFormat);
    } else if (formatType == CENTER_VERTICAL_FORMAT) {
        format.setVerticalAlignment(CellFormat.VerticalAlignmentCenter);
    } else if (formatType == TOP_VERTICAL_FORMAT) {
        format.setVerticalAlignment(CellFormat.VerticalAlignmentTop);
    } else if (formatType == SHRINK_TO_FIT) {
        format.setShrinkToFit(true);
    } else if (formatType == HEADER_ORANGE) {
        format.setFontBold(true);
        format.setVerticalAlignment(CellFormat.VerticalAlignmentCenter);
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentCenter);
        format.setPattern((short) 1);
        format.setPatternFG(Color.ORANGE);
    } else if (formatType == HEADER_YELLOW) {
        format.setFontBold(true);
        format.setVerticalAlignment(CellFormat.VerticalAlignmentCenter);
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentCenter);
        format.setPattern((short) 1);
        format.setPatternFG(Color.YELLOW);
    } else if (formatType == ALIGN_LEFT) {
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentLeft);
    } else if (formatType == ALIGN_RIGHT) {
        format.setHorizontalAlignment(CellFormat.HorizontalAlignmentRight);
    } else if (formatType == CELL_COLOR_YELLOW) {
        format.setPattern((short) 1);
        format.setPatternFG(Color.YELLOW);
    } else if (formatType == NO_WRAP_TEXT) {
        format.setWordWrap(false);
    } else if (formatType == BLACK_BORDER_NO_HORIZONTAL_NONE_WRAP) {
        short border = CellFormat.BorderThin;
        format.setLeftBorder(border);
        format.setRightBorder(border);
        format.setTopBorder(border);
        format.setBottomBorder(border);
        format.setVerticalInsideBorder(border);
        Color borderColor = Color.BLACK.darker();
        format.setLeftBorderColor(borderColor);
        format.setRightBorderColor(borderColor);
        format.setTopBorderColor(borderColor);
        format.setBottomBorderColor(borderColor);
        format.setWordWrap(false);
    } else if (formatType == BLACK_BORDER_NO_HORIZONTAL) {
        short border = CellFormat.BorderThin;
        format.setLeftBorder(border);
        format.setRightBorder(border);
        format.setTopBorder(border);
        format.setBottomBorder(border);
        format.setVerticalInsideBorder(border);
        Color borderColor = Color.BLACK.darker();
        format.setLeftBorderColor(borderColor);
        format.setRightBorderColor(borderColor);
        format.setTopBorderColor(borderColor);
        format.setBottomBorderColor(borderColor);
        format.setWordWrap(true);
    } else if (formatType == BORDER_FORMAT_NO_ROW_HEIGHT) {
        short border = CellFormat.BorderThin;
        format.setLeftBorder(border);
        format.setRightBorder(border);
        format.setTopBorder(border);
        format.setBottomBorder(border);
        format.setHorizontalInsideBorder(border);
        format.setVerticalInsideBorder(border);
        Color borderColor = Color.GREEN.darker();
        format.setLeftBorderColor(borderColor);
        format.setRightBorderColor(borderColor);
        format.setTopBorderColor(borderColor);
        format.setBottomBorderColor(borderColor);
        format.setWordWrap(true);
        // view.setRowHeightAuto(r1, c1, r2, c2, true);
    } else if (formatType == MERGE_CELL) {
        format.setMergeCells(true);
    }
    view.setCellFormat(format, r1, c1, r2, c2);
}