Skip to content

Commit

Permalink
Merge pull request #24 from daawaan4U/geila/color-change-card
Browse files Browse the repository at this point in the history
update color
  • Loading branch information
geilala authored May 29, 2024
2 parents c81d523 + 2cd6c03 commit 7f6b362
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/main/java/edu/project/components/TimeForecast.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import edu.project.api.WeatherForecast5Data;

import javax.swing.*;

import com.formdev.flatlaf.FlatClientProperties;

import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.time.LocalDateTime;
Expand All @@ -13,9 +16,10 @@
import java.util.Locale;

public class TimeForecast extends JPanel {

private static final DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h a")
.withLocale(Locale.ENGLISH); // Abbreviate the hour
private static final Color PANEL_COLOR = new Color(169, 169, 169); // Light gray color
private static final Color PANEL_COLOR = new Color(224, 224, 224); // Light gray color
private static final int ARC_WIDTH = 20; // Adjust the arc width for rounded corners
private static final int ARC_HEIGHT = 20; // Adjust the arc height for rounded corners
private static final int SPACING = 10; // Horizontal spacing between each hour panel
Expand All @@ -25,8 +29,9 @@ public class TimeForecast extends JPanel {
private final List<HourForecast> hourForecasts = new ArrayList<>();

public TimeForecast(Context context) {
putClientProperty(FlatClientProperties.STYLE,
"border: 16,16,16,16,shade(@background,10%),,16");
setOpaque(false);
setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
setLayout(new BorderLayout());

JPanel mainPanel = new JPanel(new BorderLayout());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/project/components/WeatherCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void setValue(String value) {
protected void paintComponent(Graphics graphics) {
Graphics2D graphics2d = (Graphics2D) graphics;
graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics2d.setColor(Color.LIGHT_GRAY);
graphics2d.setColor(new Color(224, 224, 224));
graphics2d.fillRoundRect(0, 0, getWidth(), getHeight(), 16, 16);
super.paintComponent(graphics);
}
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/edu/project/components/WeatherForecastPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import edu.project.api.WeatherForecast5Data;

import javax.swing.*;

import com.formdev.flatlaf.FlatClientProperties;

import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.time.LocalDate;
Expand All @@ -15,17 +18,19 @@
public class WeatherForecastPanel extends JPanel {
private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("EEE")
.withLocale(Locale.ENGLISH);
private static final Color PANEL_COLOR = new Color(169, 169, 169); // Light gray color
private static final int ARC_WIDTH = 20;
private static final int ARC_HEIGHT = 20;
private static final Color PANEL_COLOR = new Color(224, 224, 224); // Light gray color
private static final int ARC_WIDTH = 16;
private static final int ARC_HEIGHT = 16;
private static final int SPACING = 20;

private final JPanel contentPanel;
private final List<DayForecast> dayForecasts = new ArrayList<>();

public WeatherForecastPanel(Context context) {
putClientProperty(FlatClientProperties.STYLE,
"border: 16,16,16,16,shade(@background,10%),,16");

setOpaque(false);
setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 19));
setLayout(new BorderLayout());

JPanel mainPanel = new JPanel(new BorderLayout());
Expand Down

0 comments on commit 7f6b362

Please sign in to comment.