From 6bb59da4aec6fce5d19a5d4e8780e38e87352df1 Mon Sep 17 00:00:00 2001 From: Pacifico Paul <46673657+paulpacifico@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:38:23 +0400 Subject: [PATCH] Delete src/application/RoundedLineBorder.java --- src/application/RoundedLineBorder.java | 79 -------------------------- 1 file changed, 79 deletions(-) delete mode 100644 src/application/RoundedLineBorder.java diff --git a/src/application/RoundedLineBorder.java b/src/application/RoundedLineBorder.java deleted file mode 100644 index 0c891c81..00000000 --- a/src/application/RoundedLineBorder.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************************* -* Copyright (C) 2024 PACIFICO PAUL -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -* -********************************************************************************************/ - -package application; - -import java.awt.BasicStroke; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.Paint; -import java.awt.RenderingHints; -import java.awt.Stroke; - -import javax.swing.border.AbstractBorder; - -@SuppressWarnings("serial") -public class RoundedLineBorder extends AbstractBorder { - int lineSize, cornerSize; - Paint fill; - Stroke stroke; - private Object aaHint; - - public RoundedLineBorder(Paint fill, int lineSize, int cornerSize) { - this.fill = fill; - this.lineSize = lineSize; - this.cornerSize = cornerSize; - stroke = new BasicStroke(lineSize); - } - - public RoundedLineBorder(Paint fill, int lineSize, int cornerSize, boolean antiAlias) { - this.fill = fill; - this.lineSize = lineSize; - this.cornerSize = cornerSize; - stroke = new BasicStroke(lineSize); - aaHint = antiAlias? RenderingHints.VALUE_ANTIALIAS_ON: RenderingHints.VALUE_ANTIALIAS_OFF; - } - - @Override - public Insets getBorderInsets(Component c, Insets insets) { - return new Insets(1, 1, 1, 1); - } - - @Override - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - Graphics2D g2d = (Graphics2D)g; - Paint oldPaint = g2d.getPaint(); - Stroke oldStroke = g2d.getStroke(); - Object oldAA = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING); - try { - g2d.setPaint(fill!=null? fill: c.getForeground()); - g2d.setStroke(stroke); - if(aaHint != null) g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aaHint); - int off = lineSize >> 1; - g2d.drawRoundRect(x+off, y+off, width-lineSize, height-lineSize, cornerSize, cornerSize); - } - finally { - g2d.setPaint(oldPaint); - g2d.setStroke(oldStroke); - if(aaHint != null) g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAA); - } - } -} \ No newline at end of file