Skip to content

Commit

Permalink
remove edit Color button (moved to the text entry )
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmipt committed Apr 19, 2024
1 parent f6c8a57 commit 483f5da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
23 changes: 9 additions & 14 deletions src/studio/ui/ServerForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

Expand Down Expand Up @@ -120,8 +122,6 @@ private void initComponents() {
txtPassword = new javax.swing.JPasswordField();
colorLabel = new javax.swing.JLabel();
jSeparator3 = new javax.swing.JSeparator();
btnEditColor = new javax.swing.JButton();
btnEditColor.setName("editColor");
sampleTextOnBackgroundTextField = new javax.swing.JTextField();
sampleTextOnBackgroundTextField.setName("sampleTextOnBackground");
authenticationMechanism = new javax.swing.JComboBox();
Expand Down Expand Up @@ -155,16 +155,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

colorLabel.setText("Color");

btnEditColor.setText("Edit Color");
btnEditColor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
onColor(evt);
sampleTextOnBackgroundTextField.setText("Sample text on background (click to modify)");
sampleTextOnBackgroundTextField.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
onColorAction();
}
});

sampleTextOnBackgroundTextField.setText("Sample text on background");


authMethodLabel.setText("Auth. Method");

tlsLabel.setText("Use TLS");
Expand All @@ -188,7 +186,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(RELATED, 21, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnEditColor)
.addPreferredGap(RELATED, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cancelButton)
.addPreferredGap(RELATED)
Expand Down Expand Up @@ -273,8 +270,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(RELATED)
.addGroup(layout.createParallelGroup(BASELINE)
.addComponent(okButton)
.addComponent(cancelButton)
.addComponent(btnEditColor))
.addComponent(cancelButton))
.addContainerGap())
);
}
Expand Down Expand Up @@ -316,7 +312,7 @@ private void onCancel(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onCance
cancel();
}

private void onColor(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onColor
private void onColorAction() {//GEN-FIRST:event_onColor
Color result = ColorChooser.chooseColor(this, "Select background color for editor",
sampleTextOnBackgroundTextField.getBackground());

Expand All @@ -325,7 +321,6 @@ private void onColor(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onColor
}
}

private javax.swing.JButton btnEditColor;
private javax.swing.JTextField sampleTextOnBackgroundTextField;
private javax.swing.JComboBox<String> authenticationMechanism;
private javax.swing.JButton cancelButton;
Expand Down
2 changes: 1 addition & 1 deletion test-integration/studio/ui/ServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void testChangeBackgroundColor() {

Color newColor = new Color (171, 255, 171);
ColorChooser.mock(newColor);
serverDialog.button("editColor").click();
sample.click();
bgColor = execute(() -> sample.target().getBackground());
assertEquals(newColor, bgColor);

Expand Down

0 comments on commit 483f5da

Please sign in to comment.