Search in sources :

Example 16 with Color

use of java.awt.Color in project screenbird by adamhub.

the class JRoundedPanel method paintComponent.

//    public JRoundedPanel(CardLayout cardLayout) {
//        super(cardLayout);
//        setOpaque(false);
//        Color backgrnd = new Color(Color.darkGray.getRed(),Color.darkGray.getGreen(), Color.darkGray.getBlue(),180);
//        this.setBackground(backgrnd);
//    }
@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    int width = getWidth();
    int height = getHeight();
    int shadowGap = this.shadowGap;
    Color shadowColorA = new Color(shadowColor.getRed(), shadowColor.getGreen(), shadowColor.getBlue(), shadowAlpha);
    Graphics2D graphics = (Graphics2D) g;
    //Sets antialiasing if HQ.
    if (highQuality) {
        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    }
    //Draws shadow borders if any.
    if (shady) {
        graphics.setColor(shadowColorA);
        graphics.fillRoundRect(// X position
        shadowOffset, // Y position
        shadowOffset, // width
        width - strokeSize - shadowOffset, // height
        height - strokeSize - shadowOffset, arcs.width, // arc Dimension
        arcs.height);
    } else {
        shadowGap = 1;
    }
    //Draws the rounded opaque panel with borders.
    graphics.setColor(getBackground());
    graphics.fillRoundRect(0, 0, width - shadowGap, height - shadowGap, arcs.width, arcs.height);
    graphics.setColor(getForeground());
    //graphics.setStroke(new BasicStroke(strokeSize));
    //graphics.drawRoundRect(0, 0, width - shadowGap, height - shadowGap, arcs.width, arcs.height);
    //Sets strokes to default, is better.
    graphics.setStroke(new BasicStroke());
}
Also used : BasicStroke(java.awt.BasicStroke) Color(java.awt.Color) Graphics2D(java.awt.Graphics2D)

Example 17 with Color

use of java.awt.Color in project screenbird by adamhub.

the class RecorderPanel method adjustClockTimerFont.

// End of variables declaration//GEN-END:variables
public void adjustClockTimerFont() {
    Color color = jLabel6.getForeground();
    Font labelFont = jLabel6.getFont();
    String labelText = jLabel6.getText();
    int stringWidth = jLabel6.getFontMetrics(labelFont).stringWidth(labelText);
    int componentWidth = jLabel6.getWidth();
    double widthRatio = (double) componentWidth / (double) stringWidth;
    int newFontSize = (int) (labelFont.getSize() * widthRatio * 0.9);
    int componentHeight = (int) (jLabel6.getHeight() * 0.9);
    int fontSizeToUse = Math.min(newFontSize, componentHeight);
    jLabel6.setFont(new Font(labelFont.getName(), jLabel6.getFont().getStyle(), fontSizeToUse));
    jLabel6.setForeground(color);
    jLabel6.repaint();
}
Also used : Color(java.awt.Color) Font(java.awt.Font)

Example 18 with Color

use of java.awt.Color in project screenbird by adamhub.

the class RecorderPanel method showRecordingState.

/**
     * Shows recorder panel in recording sate
     */
public void showRecordingState() {
    // Show recorder controls
    this.jfRecorderPanel.controlSetVisible(true);
    // Stop preview playback, if any
    if (this.scrubManager != null) {
        this.scrubManager.endPreviewVideo();
    }
    // Hide settings form
    if (jfSettings != null) {
        this.jfSettings.hideSettingsForm();
    }
    // Hide capture box
    if (this.captureBox != null) {
        this.setToggleStateCustomFullScreen(this.captureBox.getState(), false);
        this.captureBox.setDragBoxVisible(false);
    }
    this.jpUpload.setVisible(false);
    this.jpRecorderNonRec.setVisible(false);
    this.recorderPanelBG1.setVisible(true);
    this.jToggleButton1.setEnabled(false);
    this.jToggleButton2.setEnabled(false);
    this.jToggleButton3.setSelected(true);
    this.jLabel6.setForeground(new Color(148, 148, 148));
    this.jpRecorderRec.setVisible(false);
    jToggleButton3.setToolTipText("Stop");
    jToggleButton3.setEnabled(true);
    jToggleButton3.setIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_NORMAL)));
    jToggleButton3.setSelectedIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_PRESSED)));
    jToggleButton3.setDisabledIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_DISABLED)));
    jToggleButton3.setDisabledSelectedIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_DISABLED)));
    jToggleButton3.setRolloverIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_HOVER)));
    jToggleButton3.setRolloverSelectedIcon(new ImageIcon(getClass().getResource(ResourceUtil.STOP_BUTTON_HOVER)));
    jToggleButton4.setEnabled(true);
    if (Settings.ENABLE_OOPS_FEATURE) {
        this.jfRecorderPanel.controlPack();
    } else {
        this.jpRecorderRec.setVisible(false);
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) Color(java.awt.Color)

Example 19 with Color

use of java.awt.Color in project screenbird by adamhub.

the class RecorderPanelBG method paint.

@Override
public void paint(Graphics g) {
    g.drawImage(img, 0, 0, new Color(0, 0, 0, 0), this);
    paintComponents(g);
}
Also used : Color(java.awt.Color)

Example 20 with Color

use of java.awt.Color in project screenbird by adamhub.

the class RecorderPanelTest method testShowUploadMessage.

/**
     * Test of showUploadMessage method, of class RecorderPanel.
     */
@Test
public void testShowUploadMessage() {
    System.out.println("showUploadMessage");
    String message = "Test Message";
    Color type = Color.WHITE;
    instance.showUploadMessage(message, type);
    TimeUtil.skipToMyLou(2);
    instance.showRecorderForm();
}
Also used : Color(java.awt.Color) Test(org.junit.Test)

Aggregations

Color (java.awt.Color)895 Graphics2D (java.awt.Graphics2D)117 BufferedImage (java.awt.image.BufferedImage)75 Font (java.awt.Font)63 Dimension (java.awt.Dimension)51 Point (java.awt.Point)47 ArrayList (java.util.ArrayList)46 JLabel (javax.swing.JLabel)41 BasicStroke (java.awt.BasicStroke)38 JPanel (javax.swing.JPanel)38 JScrollPane (javax.swing.JScrollPane)33 GradientPaint (java.awt.GradientPaint)31 Rectangle (java.awt.Rectangle)31 JButton (javax.swing.JButton)31 ActionEvent (java.awt.event.ActionEvent)30 Paint (java.awt.Paint)29 Insets (java.awt.Insets)26 ActionListener (java.awt.event.ActionListener)26 Component (java.awt.Component)24 GridBagConstraints (java.awt.GridBagConstraints)23