Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. JButton S1L1Reset = new JButton("Reset");
  2. S1L1Reset.setFont(new Font("Work Sans", Font.PLAIN, 14));
  3. S1L1Reset.setForeground(new Color(90, 90, 90));
  4. S1L1Reset.setBackground(new Color(220, 208, 192));
  5. S1L1Reset.setOpaque(true);
  6.  
  7. class RoundedBorder implements Border {
  8.  
  9. private int radius;
  10.  
  11. RoundedBorder(int radius) {
  12. this.radius = radius;
  13. }
  14.  
  15. public Insets getBorderInsets(Component c) {
  16. return new Insets(this.radius+1, this.radius+1, this.radius+2, this.radius);
  17. }
  18.  
  19. public boolean isBorderOpaque() {
  20. return true;
  21. }
  22.  
  23. public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  24. g.drawRoundRect(x, y, width-1, height-1, radius, radius);
  25. }
  26. }
  27.  
  28. JButton S1L1Reset = new JButton("Reset");
  29. S1L1Reset.setFont(new Font("Work Sans", Font.PLAIN, 14));
  30. S1L1Reset.setForeground(new Color(90, 90, 90));
  31. S1L1Reset.setBackground(new Color(220, 208, 192));
  32. S1L1Reset.setOpaque(true);
  33. S1L1Reset.setBorderPainted(false);
  34. S1L1Reset.setBorder(new RoundedBorder(20)); //new line of code added
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement