Guest User

slides.java

a guest
Sep 6th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.62 KB | None | 0 0
  1. package com.polonez11212;
  2.  
  3. import javax.swing.*;
  4. import java.awt.*;
  5.  
  6. public class Slides {
  7. //tutaj bedą zmiany zdjęc i tekstów
  8.  
  9. Start start;
  10. Colors colors=new Colors();
  11. PlayerVariables pv = new PlayerVariables();
  12. Fonts fonts = new Fonts();
  13. Casual casual = new Casual(this);
  14.  
  15.  
  16. JPanel variablesPanel;
  17. JTextArea textPanel;
  18. JLabel photoPanel;
  19. JLabel playerHPLabel,dayCounter;
  20. JLabel playerMPLabel;
  21. JLabel playerWeaponLabel;
  22. JTextArea descriptionPanel;
  23. ImageIcon icon;
  24. String imageDirectory=".//res/img/";
  25. String currentImage="5.jpg";
  26. int ammountOfDays=1;
  27.  
  28.  
  29. Slides(Start start){
  30. new Fonts();
  31. this.start=start;
  32.  
  33. deleteStartLayout();
  34. createNewLayout();
  35. }
  36.  
  37.  
  38.  
  39. private void deleteStartLayout(){
  40. start.titleTextLabel.setVisible(false);
  41. start.titleTextShadow.setVisible(false);
  42. start.titleButton.setVisible(false);
  43. }
  44.  
  45. private void createNewLayout() {
  46.  
  47. dayCounter=new JLabel();
  48. dayCounter.setText("Day "+ammountOfDays);
  49. dayCounter.setBounds(700,20,100,50);
  50. dayCounter.setForeground(Color.RED);
  51. dayCounter.setFont(fonts.playerVariablesFont);
  52. start.add(dayCounter);
  53.  
  54. pv.setPlayerHP(100);
  55. pv.setPlayerWater(100);
  56. pv.setPlayerWeaponName("Knife");
  57. icon=new ImageIcon(imageDirectory+currentImage+"");
  58. photoPanel=new JLabel();
  59. photoPanel.setToolTipText("This Panel shows current picture");
  60. photoPanel.setBounds(50,30,600,400);
  61. photoPanel.setIcon(icon);
  62. photoPanel.setFocusable(false);
  63. start.add(photoPanel);
  64.  
  65. variablesPanel=new JPanel();
  66. variablesPanel.setBounds(700,30,250,400);
  67. variablesPanel.setBackground(colors.layoutBackgroundColor);
  68. variablesPanel.setToolTipText("This Panel shows Player Variables");
  69. variablesPanel.setFocusable(false);
  70. variablesPanel.setLayout(new GridLayout(3,2));
  71.  
  72.  
  73. JLabel healthL = new JLabel("Health: ");
  74. healthL.setForeground(colors.variablesColor);
  75. healthL.setFont(fonts.playerVariablesFont);
  76. variablesPanel.add(healthL);
  77.  
  78. playerHPLabel=new JLabel(pv.getPlayerHP()+" HP");
  79. playerHPLabel.setForeground(colors.variablesColor);
  80. playerHPLabel.setFont(fonts.playerVariablesFont);
  81. variablesPanel.add(playerHPLabel);
  82.  
  83. JLabel manaL =new JLabel("Water: ");
  84. manaL.setForeground(colors.variablesColor);
  85. manaL.setFont(fonts.playerVariablesFont);
  86. variablesPanel.add(manaL);
  87.  
  88. playerMPLabel=new JLabel(""+pv.getPlayerWater()+" UNITS");
  89. playerMPLabel.setForeground(colors.variablesColor);
  90. playerMPLabel.setFont(fonts.playerVariablesFont);
  91. variablesPanel.add(playerMPLabel);
  92.  
  93. JLabel weaponL = new JLabel("Weapon: ");
  94. weaponL.setForeground(colors.variablesColor);
  95. weaponL.setFont(fonts.playerVariablesFont);
  96. variablesPanel.add(weaponL);
  97.  
  98. playerWeaponLabel=new JLabel(pv.getPlayerWeaponName()+"");
  99. playerWeaponLabel.setForeground(colors.variablesColor);
  100. playerWeaponLabel.setFont(fonts.playerVariablesFont);
  101. variablesPanel.add(playerWeaponLabel);
  102.  
  103. start.add(variablesPanel);
  104.  
  105. textPanel=new JTextArea("This is main Text Area. If You see this, this is displaying properly");
  106. textPanel.setToolTipText("This is Panel where Story is");
  107. textPanel.setFocusable(false);
  108. textPanel.setForeground(colors.layoutTextColor);
  109. textPanel.setBackground(colors.layoutTextBackgroundColor);
  110.  
  111.  
  112. textPanel.setBounds(50,480,700,250);
  113. textPanel.setWrapStyleWord(true);
  114. textPanel.setFocusable(false);
  115. textPanel.setLineWrap(true);
  116. textPanel.setFont(fonts.textFont);
  117. textPanel.setEditable(false);
  118. start.add(textPanel);
  119.  
  120. descriptionPanel=new JTextArea("Use \"WASD\" or arrows to navigate.\n\nHave fun!");
  121. descriptionPanel.setToolTipText("This is Panel where u can see an advise");
  122. descriptionPanel.setWrapStyleWord(true);
  123. descriptionPanel.setFocusable(false);
  124. descriptionPanel.setLineWrap(true);
  125. descriptionPanel.setEditable(false);
  126. descriptionPanel.setOpaque(false);
  127. descriptionPanel.setFont(fonts.descriptionFont);
  128. descriptionPanel.setBounds(800,530,150,100);
  129. descriptionPanel.setForeground(colors.layoutDescriptionLabelColor);
  130. start.add(descriptionPanel);
  131. casual.firstDay();
  132. start.repaint();
  133.  
  134.  
  135. }
  136.  
  137.  
  138. }
  139.  
Add Comment
Please, Sign In to add comment