-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
43 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/edu/project/components/WeatherCardGroup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package edu.project.components; | ||
|
||
import java.awt.GridLayout; | ||
|
||
import javax.swing.JPanel; | ||
|
||
import edu.project.Context; | ||
|
||
public class WeatherCardGroup extends JPanel { | ||
public WeatherCardGroup(Context context) { | ||
setOpaque(false); | ||
setLayout(new GridLayout(1, 4, 8, 0)); | ||
|
||
WeatherCard windCard = new WeatherCard("Wind", "m/s"); | ||
WeatherCard humidityCard = new WeatherCard("Humidity", "%"); | ||
WeatherCard rainRateCard = new WeatherCard("Rain Rate", "mm/h"); | ||
WeatherCard pressureCard = new WeatherCard("Cloud", "%"); | ||
|
||
add(windCard); | ||
add(humidityCard); | ||
add(rainRateCard); | ||
add(pressureCard); | ||
|
||
context.store.addWeatherCurrentDataListener(data -> { | ||
windCard.setValue(String.format("%.1f", data.wind.speed)); | ||
humidityCard.setValue(String.format("%d", data.main.humidity)); | ||
rainRateCard.setValue(String.format("%.1f", data.rain != null ? data.rain.one_hour : 0)); | ||
pressureCard.setValue(String.format("%d", data.clouds.all)); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
src/main/java/edu/project/components/weathercards/WeatherGroup.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/main/java/edu/project/components/weathercards/WeatherHumidityCard.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/main/java/edu/project/components/weathercards/WeatherRainRateCard.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/main/java/edu/project/components/weathercards/WeatherUVCard.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/main/java/edu/project/components/weathercards/WeatherWindCard.java
This file was deleted.
Oops, something went wrong.