Advertisement
Guest User

deber motos

a guest
Jun 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1.  
  2. package pakete;
  3.  
  4. import java.awt.BorderLayout;
  5. import java.awt.EventQueue;
  6.  
  7. import javax.swing.JFrame;
  8. import javax.swing.JPanel;
  9. import javax.swing.border.EmptyBorder;
  10. import javax.swing.JLabel;
  11. import java.awt.Font;
  12. import javax.swing.JButton;
  13. import java.awt.Color;
  14. import javax.swing.ImageIcon;
  15. import java.awt.event.ActionListener;
  16. import java.awt.event.ActionEvent;
  17. import java.awt.Toolkit;
  18. import javax.swing.JTextField;
  19.  
  20. public class MOT05 extends JFrame {
  21.  
  22. private JPanel contentPane;
  23. private JTextField costo;
  24.  
  25. /**
  26. * Launch the application.
  27. */
  28. public static void main(String[] args) {
  29. EventQueue.invokeLater(new Runnable() {
  30. public void run() {
  31. try {
  32. MOT05 frame = new MOT05();
  33. frame.setVisible(true);
  34. } catch (Exception e) {
  35. e.printStackTrace();
  36. }
  37. }
  38. });
  39. }
  40.  
  41. /**
  42. * Create the frame.
  43. */
  44. public MOT05() {
  45. setIconImage(Toolkit.getDefaultToolkit().getImage("\\\\10.0.29.228\\Docentes\\Nora Hernandez 2019\\Iconos\\EmojiOne_3.0_64x64_png\\1f3cd.png"));
  46. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  47. setBounds(100, 100, 800, 632);
  48. contentPane = new JPanel();
  49. contentPane.setBackground(Color.WHITE);
  50. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  51. setContentPane(contentPane);
  52. contentPane.setLayout(null);
  53.  
  54. JLabel lblNewLabel = new JLabel("TALLER DE MOTONETAS\r\n");
  55. lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 17));
  56. lblNewLabel.setBounds(303, 11, 204, 21);
  57. contentPane.add(lblNewLabel);
  58.  
  59. JButton button = new JButton("");
  60. button.setBorderPainted(false);
  61. button.addActionListener(new ActionListener() {
  62. public void actionPerformed(ActionEvent arg0) {
  63. }
  64. });
  65. button.setIcon(new ImageIcon("C:\\Users\\aVA\\Desktop\\los-deportes-de-motor.png"));
  66. button.setBackground(Color.WHITE);
  67. button.setBounds(20, 71, 176, 177);
  68. contentPane.add(button);
  69.  
  70. JButton button_1 = new JButton("");
  71. button_1.setBorderPainted(false);
  72. button_1.setIcon(new ImageIcon("C:\\Users\\aVA\\Desktop\\los-deportes-de-motor.png"));
  73. button_1.setBackground(Color.WHITE);
  74. button_1.setBounds(589, 71, 176, 177);
  75. contentPane.add(button_1);
  76.  
  77. costo = new JTextField();
  78. costo.setBackground(Color.LIGHT_GRAY);
  79. costo.setFont(new Font("Tahoma", Font.BOLD, 15));
  80. costo.setBounds(247, 235, 285, 20);
  81. contentPane.add(costo);
  82. costo.setColumns(10);
  83.  
  84. JLabel lblIngreseCostoDe = new JLabel("Ingrese costo de reparacion");
  85. lblIngreseCostoDe.setFont(new Font("Tahoma", Font.BOLD, 17));
  86. lblIngreseCostoDe.setBounds(247, 203, 240, 21);
  87. contentPane.add(lblIngreseCostoDe);
  88.  
  89. JButton btnEnviaru = new JButton("Enviar :3\r\n");
  90.  
  91.  
  92. btnEnviaru.setBounds(338, 281, 89, 23);
  93. contentPane.add(btnEnviaru);
  94.  
  95. JLabel resultado = new JLabel("Su costo total es:");
  96. resultado.setFont(new Font("Tahoma", Font.BOLD, 17));
  97. resultado.setBounds(24, 385, 240, 21);
  98. contentPane.add(resultado);
  99.  
  100. JButton btnLimpiar = new JButton("Limpiar");
  101. btnLimpiar.setBounds(676, 560, 89, 23);
  102. contentPane.add(btnLimpiar);
  103.  
  104. btnEnviaru.addActionListener(new ActionListener() {
  105. public void actionPerformed(ActionEvent e) {
  106.  
  107. resultado.setText(String.valueOf(linus(costo.getText())));
  108.  
  109. }
  110. });
  111. }
  112.  
  113. public static int linus(String luke) {
  114. int dennis=0;
  115. dennis=Integer.parseInt(luke)+(Integer.parseInt(luke)*20)/100;
  116. dennis=dennis+(dennis*22)/100;
  117. return dennis;
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement