reformat all code

This commit is contained in:
OMGeeky
2025-06-21 18:36:37 +02:00
parent bb187621b7
commit 90359bf285
120 changed files with 31732 additions and 31504 deletions

View File

@@ -1,96 +1,93 @@
package com.gpl.rpg.atcontentstudio.ui;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import javax.swing.JComponent;
import javax.swing.*;
import java.awt.*;
public class JMovingIdler extends JComponent {
private static final long serialVersionUID = -2980521421870322717L;
int position = 0;
boolean destroyed=false, running=false;
Thread moverThread = new Thread(){
public void run() {
while (!destroyed) {
boolean back = false;
while (running) {
if (back) {
position = --position % 100;
if (position == 0) {
back = false;
}
} else {
position = ++position % 100;
if (position == 99) {
back = true;
}
}
try {
sleep(10);
} catch (InterruptedException e) {}
JMovingIdler.this.revalidate();
JMovingIdler.this.repaint();
}
}
}
};
public void start() {
if (!moverThread.isAlive()) {
moverThread.start();
}
running = true;
}
public void stop() {
running = false;
}
public void destroy() {
destroyed = true;
running = false;
try {
moverThread.join();
} catch (InterruptedException e) {}
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
int w = this.getWidth();
int h = this.getHeight();
g2.setColor(getBackground());
g2.fillRect(0,0,w,h);
int x = w * position / 100;
Paint p = new GradientPaint(x - (w/8), 0, getBackground(), x , 0, getForeground());
g2.setPaint(p);
g2.fillRect(Math.max(0,x-(w/8)),0, Math.min(x, w), h);
private static final long serialVersionUID = -2980521421870322717L;
int position = 0;
boolean destroyed = false, running = false;
Thread moverThread = new Thread() {
public void run() {
while (!destroyed) {
boolean back = false;
while (running) {
if (back) {
position = --position % 100;
if (position == 0) {
back = false;
}
} else {
position = ++position % 100;
if (position == 99) {
back = true;
}
}
try {
sleep(10);
} catch (InterruptedException e) {
}
JMovingIdler.this.revalidate();
JMovingIdler.this.repaint();
}
}
}
};
public void start() {
if (!moverThread.isAlive()) {
moverThread.start();
}
running = true;
}
public void stop() {
running = false;
}
public void destroy() {
destroyed = true;
running = false;
try {
moverThread.join();
} catch (InterruptedException e) {
}
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
int w = this.getWidth();
int h = this.getHeight();
g2.setColor(getBackground());
g2.fillRect(0, 0, w, h);
int x = w * position / 100;
Paint p = new GradientPaint(x - (w / 8), 0, getBackground(), x, 0, getForeground());
g2.setPaint(p);
g2.fillRect(Math.max(0, x - (w / 8)), 0, Math.min(x, w), h);
p = new GradientPaint(x, 0, getForeground(), x + (w / 8), 0, getBackground());
g2.setPaint(p);
g2.fillRect(Math.max(0, x), 0, Math.min(x + (w / 8), w), h);
g2.setColor(Color.BLACK);
g2.drawLine(0, 0, 0, h);
g2.drawLine(0, 0, w, 0);
g2.drawLine(w, 0, w, h);
g2.drawLine(0, h, w, h);
}
@Override
public void setVisible(boolean aFlag) {
super.setVisible(aFlag);
if (!aFlag) destroy();
}
p = new GradientPaint(x, 0, getForeground(), x + (w/8), 0, getBackground());
g2.setPaint(p);
g2.fillRect(Math.max(0,x),0, Math.min(x+(w/8), w), h);
g2.setColor(Color.BLACK);
g2.drawLine(0,0,0,h);
g2.drawLine(0,0,w,0);
g2.drawLine(w,0,w,h);
g2.drawLine(0,h,w,h);
}
@Override
public void setVisible(boolean aFlag) {
super.setVisible(aFlag);
if (!aFlag) destroy();
}
}