Search in sources :

Example 1 with Color

use of java.awt.Color in project cogtool by cogtool.

the class AbstractAcceptListener method signalViolation.

protected void signalViolation(String msg) {
    final Color bg = _field.getBackground();
    _field.setBackground(Binding.INVALID_COLOR);
    MainFrame.getInstance().warn(msg);
    _field.setBackground(bg);
    _field.requestFocusInWindow();
}
Also used : Color(java.awt.Color)

Example 2 with Color

use of java.awt.Color in project checkstyle by checkstyle.

the class InputSemantic method otherInstantiations.

void otherInstantiations() {
    // instantiation of classes in the same package
    Object o1 = new InputBraces();
    Object o2 = new InputModifier();
    // classes in another package with .* import
    ByteArrayOutputStream s = new ByteArrayOutputStream();
    File f = new File("/tmp");
    // classes in another package with explicit import
    Dimension dim = new Dimension();
    Color col = new Color(0, 0, 0);
}
Also used : Color(java.awt.Color) Dimension(java.awt.Dimension)

Example 3 with Color

use of java.awt.Color in project checkstyle by checkstyle.

the class InputSemantic method otherInstantiations.

void otherInstantiations() {
    // instantiation of classes in the same package
    Object o1 = new InputBraces();
    Object o2 = new InputModifier();
    // classes in another package with .* import
    ByteArrayOutputStream s = new ByteArrayOutputStream();
    File f = new File("/tmp");
    // classes in another package with explicit import
    Dimension dim = new Dimension();
    Color col = new Color(0, 0, 0);
}
Also used : Color(java.awt.Color) Dimension(java.awt.Dimension)

Example 4 with Color

use of java.awt.Color in project jersey by jersey.

the class MainWindow method createRequestStatusLabel.

private JLabel createRequestStatusLabel() {
    final JLabel label = new JLabel("   ");
    invokeAndWait(new Runnable() {

        @Override
        public void run() {
            label.setBackground(PROGRESS_COLOR);
            label.setToolTipText("Running...");
            label.setBorder(javax.swing.BorderFactory.createLineBorder(new Color(0, 0, 0)));
            label.setOpaque(true);
            messagePanel.add(label);
            messagePanel.revalidate();
        }
    });
    return label;
}
Also used : Color(java.awt.Color) JLabel(javax.swing.JLabel)

Example 5 with Color

use of java.awt.Color in project Openfire by igniterealtime.

the class ConversationUtils method buildPDFContent.

private ByteArrayOutputStream buildPDFContent(Conversation conversation, Map<String, Font> colorMap) {
    Font roomEvent = FontFactory.getFont(FontFactory.HELVETICA, 12f, Font.ITALIC, new Color(0xFF, 0x00, 0xFF));
    try {
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        writer.setPageEvent(new PDFEventListener());
        document.open();
        Paragraph p = new Paragraph(LocaleUtils.getLocalizedString("archive.search.pdf.title", MonitoringConstants.NAME), FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD));
        document.add(p);
        document.add(Chunk.NEWLINE);
        ConversationInfo coninfo = new ConversationUtils().getConversationInfo(conversation.getConversationID(), false);
        String participantsDetail;
        if (coninfo.getAllParticipants() == null) {
            participantsDetail = coninfo.getParticipant1() + ", " + coninfo.getParticipant2();
        } else {
            participantsDetail = String.valueOf(coninfo.getAllParticipants().length);
        }
        Paragraph chapterTitle = new Paragraph(LocaleUtils.getLocalizedString("archive.search.pdf.participants", MonitoringConstants.NAME) + " " + participantsDetail, FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD));
        document.add(chapterTitle);
        Paragraph startDate = new Paragraph(LocaleUtils.getLocalizedString("archive.search.pdf.startdate", MonitoringConstants.NAME) + " " + coninfo.getDate(), FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD));
        document.add(startDate);
        Paragraph duration = new Paragraph(LocaleUtils.getLocalizedString("archive.search.pdf.duration", MonitoringConstants.NAME) + " " + coninfo.getDuration(), FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD));
        document.add(duration);
        Paragraph messageCount = new Paragraph(LocaleUtils.getLocalizedString("archive.search.pdf.messagecount", MonitoringConstants.NAME) + " " + conversation.getMessageCount(), FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD));
        document.add(messageCount);
        document.add(Chunk.NEWLINE);
        Paragraph messageParagraph;
        for (ArchivedMessage message : conversation.getMessages()) {
            String time = JiveGlobals.formatTime(message.getSentDate());
            String from = message.getFromJID().getNode();
            if (conversation.getRoom() != null) {
                from = message.getToJID().getResource();
            }
            String body = message.getBody();
            String prefix;
            if (!message.isRoomEvent()) {
                prefix = "[" + time + "] " + from + ":  ";
                Font font = colorMap.get(message.getFromJID().toString());
                if (font == null) {
                    font = colorMap.get(message.getFromJID().toBareJID());
                }
                if (font == null) {
                    font = FontFactory.getFont(FontFactory.HELVETICA, 12f, Font.BOLD, Color.BLACK);
                }
                messageParagraph = new Paragraph(new Chunk(prefix, font));
            } else {
                prefix = "[" + time + "] ";
                messageParagraph = new Paragraph(new Chunk(prefix, roomEvent));
            }
            messageParagraph.add(body);
            messageParagraph.add(" ");
            document.add(messageParagraph);
        }
        document.close();
        return baos;
    } catch (DocumentException e) {
        Log.error("error creating PDF document: " + e.getMessage(), e);
        return null;
    }
}
Also used : PdfWriter(com.lowagie.text.pdf.PdfWriter) Color(java.awt.Color) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Document(com.lowagie.text.Document) Chunk(com.lowagie.text.Chunk) Font(com.lowagie.text.Font) Paragraph(com.lowagie.text.Paragraph) DocumentException(com.lowagie.text.DocumentException)

Aggregations

Color (java.awt.Color)2973 Graphics2D (java.awt.Graphics2D)396 Font (java.awt.Font)250 BufferedImage (java.awt.image.BufferedImage)236 Dimension (java.awt.Dimension)193 JPanel (javax.swing.JPanel)193 Point (java.awt.Point)188 BasicStroke (java.awt.BasicStroke)177 ArrayList (java.util.ArrayList)173 Test (org.junit.Test)156 JLabel (javax.swing.JLabel)148 Paint (java.awt.Paint)140 Rectangle (java.awt.Rectangle)109 GradientPaint (java.awt.GradientPaint)108 Insets (java.awt.Insets)103 GridBagConstraints (java.awt.GridBagConstraints)96 IOException (java.io.IOException)96 Stroke (java.awt.Stroke)94 JScrollPane (javax.swing.JScrollPane)93 File (java.io.File)89