Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class InfoPane extends BorderPane{
- GridPane infoGrid;
- Oil oil;
- Label name;
- Label botanicalName;
- ArrayList<Label> compatibleOils;
- ArrayList<Label> ailments;
- ArrayList<Label> warnings;
- Label notes;
- public InfoPane()
- {
- infoGrid = new GridPane();
- oil = new Oil();
- name = new Label();
- botanicalName = new Label();
- compatibleOils = new ArrayList<>();
- ailments = new ArrayList<>();
- warnings = new ArrayList<>();
- notes = new Label();
- }
- public void setOil(Oil setOil)
- {
- oil = setOil;
- name.setText("Name: " + oil.getName());
- botanicalName.setText("Botanical Name: " + oil.getBotanicalName());
- compatibleOils.clear();
- for(int i = 0; i < oil.getCompatibleOilSize(); i++){compatibleOils.add(new Label(oil.getOil(i).getName()));}
- ailments.clear();
- for(int i = 0; i < oil.getAilmentSize(); i++){ailments.add(new Label(oil.getOil(i).getName()));}
- warnings.clear();
- for(int i = 0; i < oil.getWarningSize(); i++){warnings.add(new Label(oil.getOil(i).getName()));}
- placeItems();
- }
- private void placeItems()
- {
- int x = 0; int y = 0;
- this.setCenter(infoGrid);
- infoGrid.add(name, x, y);
- infoGrid.add(botanicalName, x + 1, y); y++;
- infoGrid.add(new Label("Compatible Oils:"), x, y); y++;
- for(int i = 0; i < compatibleOils.size(); i ++)
- {
- infoGrid.add(compatibleOils.get(i),x+1,y);y++;
- }
- infoGrid.add(new Label("Ailments:"), x, y); y++;
- for(int i = 0; i < ailments.size(); i ++)
- {
- infoGrid.add(ailments.get(i),x+1,y);y++;
- }
- infoGrid.add(new Label("Warnings:"), x, y); y++;
- for(int i = 0; i < warnings.size(); i ++)
- {
- infoGrid.add(warnings.get(i),x+1,y);y++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement