mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added sqlite support - wip 5
This commit is contained in:
parent
d28b92915e
commit
119bba1578
@ -21,6 +21,7 @@ import org.nanoboot.utils.timecalc.swing.progress.WalkingHumanProgress;
|
|||||||
import org.nanoboot.utils.timecalc.swing.progress.WeekBattery;
|
import org.nanoboot.utils.timecalc.swing.progress.WeekBattery;
|
||||||
import org.nanoboot.utils.timecalc.swing.progress.YearBattery;
|
import org.nanoboot.utils.timecalc.swing.progress.YearBattery;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.Constants;
|
import org.nanoboot.utils.timecalc.utils.common.Constants;
|
||||||
|
import org.nanoboot.utils.timecalc.utils.common.FileConstants;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.Jokes;
|
import org.nanoboot.utils.timecalc.utils.common.Jokes;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.TTime;
|
import org.nanoboot.utils.timecalc.utils.common.TTime;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
||||||
@ -31,6 +32,7 @@ import java.awt.Color;
|
|||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert Vokac
|
* @author Robert Vokac
|
||||||
@ -256,6 +258,8 @@ public class MainWindow extends TWindow {
|
|||||||
|
|
||||||
remainingTextField.setBoundsFromLeft(remainingTextFieldLabel);
|
remainingTextField.setBoundsFromLeft(remainingTextFieldLabel);
|
||||||
remainingTextField.setEditable(false);
|
remainingTextField.setEditable(false);
|
||||||
|
TButton saveButton = new TButton("Save", 80);
|
||||||
|
saveButton.setBoundsFromLeft(remainingTextField);
|
||||||
//
|
//
|
||||||
|
|
||||||
add(departureTextFieldLabel);
|
add(departureTextFieldLabel);
|
||||||
@ -264,6 +268,12 @@ public class MainWindow extends TWindow {
|
|||||||
add(elapsedTextField);
|
add(elapsedTextField);
|
||||||
add(remainingTextFieldLabel);
|
add(remainingTextFieldLabel);
|
||||||
add(remainingTextField);
|
add(remainingTextField);
|
||||||
|
add(saveButton);
|
||||||
|
saveButton.addActionListener(e -> {
|
||||||
|
TTime overtime_ =overtimeTextField.asTimeHM();
|
||||||
|
Utils.writeTextToFile(FileConstants.STARTTIME_TXT, arrivalTextField.asTimeHM().toString().substring(0,5));
|
||||||
|
Utils.writeTextToFile(FileConstants.OVERTIME_TXT, overtime_.toString().substring(0,overtime_.isNegative() ? 6 : 5));
|
||||||
|
});
|
||||||
//
|
//
|
||||||
configButton.setBoundsFromTop(departureTextFieldLabel);
|
configButton.setBoundsFromTop(departureTextFieldLabel);
|
||||||
workDaysButton.setBoundsFromLeft(configButton);
|
workDaysButton.setBoundsFromLeft(configButton);
|
||||||
|
@ -28,9 +28,14 @@ public class TButton extends JButton implements GetProperty {
|
|||||||
Visibility.STRONGLY_COLORED.name());
|
Visibility.STRONGLY_COLORED.name());
|
||||||
private Color originalBackground;
|
private Color originalBackground;
|
||||||
private Color originalForeground;
|
private Color originalForeground;
|
||||||
|
private int customWidth = 0;
|
||||||
|
|
||||||
public TButton(String label) {
|
public TButton(String label) {
|
||||||
|
this(label, 0);
|
||||||
|
}
|
||||||
|
public TButton(String label, int customWidth) {
|
||||||
super(label);
|
super(label);
|
||||||
|
this.customWidth = customWidth;
|
||||||
new Timer(100, e -> {
|
new Timer(100, e -> {
|
||||||
if (!MainWindow.hideShowFormsCheckBox.isSelected()) {
|
if (!MainWindow.hideShowFormsCheckBox.isSelected()) {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
@ -52,7 +57,7 @@ public class TButton extends JButton implements GetProperty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBounds(int x, int y) {
|
public void setBounds(int x, int y) {
|
||||||
setBounds(x, y, BUTTON_WIDTH, BUTTON_HEIGHT);
|
setBounds(x, y, customWidth == 0 ? BUTTON_WIDTH : customWidth, BUTTON_HEIGHT);
|
||||||
this.originalBackground = getBackground();
|
this.originalBackground = getBackground();
|
||||||
this.originalForeground = getForeground();
|
this.originalForeground = getForeground();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user