Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.88 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3.  
  4. import javax.swing.JOptionPane;
  5. import javax.swing.UIManager;
  6. import javax.swing.plaf.FontUIResource;
  7. public class MethodPractice
  8. {
  9.  public static double biggest()
  10.   {
  11.    
  12.    double double1 = Double.parseDouble(JOptionPane.showInputDialog("Enter a double:"));
  13.    double double2 = Double.parseDouble(JOptionPane.showInputDialog("Enter another double:"));
  14.    double biggest = Math.max(double1,double2);
  15.    return biggest;
  16.    
  17.    
  18.   }
  19.   public static double average (int num1, int num2)
  20.   {
  21.  
  22.    double average = (num1 +num2)/2.0;
  23.    return average;
  24.  
  25.   }
  26.   public static void pigLatin(String english)
  27.   {
  28.   char first = english.charAt(0);
  29.   String second = english.substring(1);
  30.   String pig = second + first + "ay";
  31.   return pigLatin;
  32.   }
  33.  
  34.  
  35.  public static void changeJOP()
  36.  {
  37.     // Here are the commands to change the color & fonts in
  38.     // the showMessageDialog() window:
  39.    
  40.     // The font of the message text
  41.     UIManager.put("Label.font", new FontUIResource
  42.       (new Font("Baskerville Old Face", Font.BOLD, 45)));
  43.     // The color of the message text
  44.     UIManager.put("OptionPane.messageForeground",new Color(72,61,139));
  45.    
  46.     // The color of the panel
  47.     UIManager.put("Panel.background",new Color(205,197,191));
  48.     // The color around the outside of the panel
  49.     UIManager.put("OptionPane.background",new Color(124-252-0));
  50.    
  51.    
  52.     // Buttons at bottom
  53.     UIManager.put("Button.background",new Color(132,112,255));
  54.     UIManager.put("Button.foreground", new Color(72,61,139));
  55.     UIManager.put("Button.font", new FontUIResource
  56.       (new Font("Tempus Sans ITC", Font.BOLD, 14)));
  57.    
  58.  
  59.   }
  60.  
  61.  public static void main(String[] args)
  62.  {
  63.    changeJOP();
  64.    System.out.println(biggest());
  65.    System.out.println(average());
  66.    System.out.println(pigLatin(String english));
  67.    
  68.    
  69.  }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement