Skip to content

Commit ddd6668

Browse files
committed
Heatmap Defaults
Added radio buttons to allow for quick selection of common colors (Red/Blue/Black) instead of requiring the user to use the RGB pop-up selector for anything other than Red
1 parent bddd7d1 commit ddd6668

1 file changed

Lines changed: 60 additions & 12 deletions

File tree

src/window_interface/Figure_Generation/HeatMapWindow.java

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public void actionPerformed(ActionEvent arg0) {
178178
contentPane.add(btnRemove);
179179

180180
btnGen = new JButton("Generate");
181-
sl_contentPane.putConstraint(SpringLayout.SOUTH, scrollPane, -323, SpringLayout.NORTH, btnGen);
181+
sl_contentPane.putConstraint(SpringLayout.SOUTH, scrollPane, -340, SpringLayout.NORTH, btnGen);
182182
sl_contentPane.putConstraint(SpringLayout.WEST, btnGen, 167, SpringLayout.WEST, contentPane);
183183
sl_contentPane.putConstraint(SpringLayout.SOUTH, btnGen, 0, SpringLayout.SOUTH, contentPane);
184184
sl_contentPane.putConstraint(SpringLayout.EAST, btnGen, -175, SpringLayout.EAST, contentPane);
@@ -198,7 +198,7 @@ public void actionPerformed(ActionEvent arg0) {
198198
contentPane.add(lblInputMatrixParameters);
199199

200200
JLabel lblStartingRow = new JLabel("Starting Row:");
201-
sl_contentPane.putConstraint(SpringLayout.NORTH, lblStartingRow, 6, SpringLayout.SOUTH, lblInputMatrixParameters);
201+
sl_contentPane.putConstraint(SpringLayout.NORTH, lblStartingRow, 10, SpringLayout.SOUTH, lblInputMatrixParameters);
202202
sl_contentPane.putConstraint(SpringLayout.WEST, lblStartingRow, 25, SpringLayout.WEST, contentPane);
203203
contentPane.add(lblStartingRow);
204204

@@ -212,7 +212,7 @@ public void actionPerformed(ActionEvent arg0) {
212212
txtRow.setColumns(10);
213213

214214
JLabel lblStartingColumn = new JLabel("Starting Column:");
215-
sl_contentPane.putConstraint(SpringLayout.NORTH, lblStartingColumn, 6, SpringLayout.SOUTH, lblInputMatrixParameters);
215+
sl_contentPane.putConstraint(SpringLayout.NORTH, lblStartingColumn, 10, SpringLayout.SOUTH, lblInputMatrixParameters);
216216
sl_contentPane.putConstraint(SpringLayout.WEST, lblStartingColumn, 10, SpringLayout.EAST, txtRow);
217217
contentPane.add(lblStartingColumn);
218218

@@ -226,9 +226,9 @@ public void actionPerformed(ActionEvent arg0) {
226226
txtCol.setColumns(10);
227227

228228
JSeparator separator = new JSeparator();
229+
sl_contentPane.putConstraint(SpringLayout.SOUTH, separator, 15, SpringLayout.SOUTH, lblStartingRow);
229230
sl_contentPane.putConstraint(SpringLayout.EAST, separator, -10, SpringLayout.EAST, contentPane);
230231
sl_contentPane.putConstraint(SpringLayout.WEST, separator, 10, SpringLayout.WEST, contentPane);
231-
sl_contentPane.putConstraint(SpringLayout.SOUTH, separator, 10, SpringLayout.SOUTH, lblStartingRow);
232232
separator.setForeground(Color.BLACK);
233233
contentPane.add(separator);
234234

@@ -237,19 +237,67 @@ public void actionPerformed(ActionEvent arg0) {
237237
sl_contentPane.putConstraint(SpringLayout.WEST, lblSelectColor, 15, SpringLayout.WEST, contentPane);
238238
contentPane.add(lblSelectColor);
239239

240+
JRadioButton rdbtnRed = new JRadioButton("Red");
241+
sl_contentPane.putConstraint(SpringLayout.NORTH, rdbtnRed, -4, SpringLayout.NORTH, lblSelectColor);
242+
sl_contentPane.putConstraint(SpringLayout.WEST, rdbtnRed, 8, SpringLayout.EAST, lblSelectColor);
243+
rdbtnRed.setForeground(new Color(255,0,0));
244+
245+
contentPane.add(rdbtnRed);
246+
247+
JRadioButton rdbtnBlue = new JRadioButton("Blue");
248+
sl_contentPane.putConstraint(SpringLayout.NORTH, rdbtnBlue, 0, SpringLayout.NORTH, rdbtnRed);
249+
sl_contentPane.putConstraint(SpringLayout.WEST, rdbtnBlue, 8, SpringLayout.EAST, rdbtnRed);
250+
rdbtnBlue.setForeground(new Color(0,0,255));
251+
252+
contentPane.add(rdbtnBlue);
253+
254+
JRadioButton rdbtnCustom = new JRadioButton("Custom");
255+
sl_contentPane.putConstraint(SpringLayout.WEST, rdbtnCustom, 8, SpringLayout.EAST, rdbtnBlue);
256+
sl_contentPane.putConstraint(SpringLayout.SOUTH, rdbtnCustom, 0, SpringLayout.SOUTH, rdbtnRed);
257+
rdbtnCustom.setForeground(new Color(0,0,0));
258+
contentPane.add(rdbtnCustom);
259+
240260
btnColor = new JButton("Heatmap Color");
241-
sl_contentPane.putConstraint(SpringLayout.NORTH, btnColor, -6, SpringLayout.NORTH, lblSelectColor);
242-
sl_contentPane.putConstraint(SpringLayout.WEST, btnColor, 10, SpringLayout.EAST, lblSelectColor);
243-
btnColor.setForeground(Color.RED);
261+
sl_contentPane.putConstraint(SpringLayout.NORTH, btnColor, -2, SpringLayout.NORTH, rdbtnCustom);
262+
sl_contentPane.putConstraint(SpringLayout.WEST, btnColor, 8, SpringLayout.EAST, rdbtnCustom);
263+
btnColor.setForeground(new Color(0,0,0));
244264
btnColor.addActionListener(new ActionListener() {
245265
public void actionPerformed(ActionEvent arg0) {
246266
btnColor.setForeground(JColorChooser.showDialog(btnColor, "Select a Heatmap Color", btnColor.getForeground()));
267+
if(btnColor.getForeground().equals(new Color(255,0,0))) { rdbtnRed.setSelected(true); }
268+
else if(btnColor.getForeground().equals(new Color(0,0,255))) { rdbtnBlue.setSelected(true); }
269+
else {
270+
rdbtnCustom.setForeground(btnColor.getForeground());
271+
rdbtnCustom.setSelected(true);
272+
}
273+
247274
}
248275
});
249276
contentPane.add(btnColor);
250277

278+
ButtonGroup HeatColor = new ButtonGroup();
279+
HeatColor.add(rdbtnRed);
280+
HeatColor.add(rdbtnBlue);
281+
HeatColor.add(rdbtnCustom);
282+
rdbtnCustom.setSelected(true);
283+
rdbtnRed.addItemListener(new ItemListener() {
284+
public void itemStateChanged(ItemEvent e) {
285+
if(rdbtnRed.isSelected()) { btnColor.setForeground(new Color(255,0,0)); }
286+
}
287+
});
288+
rdbtnBlue.addItemListener(new ItemListener() {
289+
public void itemStateChanged(ItemEvent e) {
290+
if(rdbtnBlue.isSelected()) { btnColor.setForeground(new Color(0,0,255)); }
291+
}
292+
});
293+
rdbtnCustom.addItemListener(new ItemListener() {
294+
public void itemStateChanged(ItemEvent e) {
295+
if(rdbtnCustom.isSelected()) { btnColor.setForeground(rdbtnCustom.getForeground()); }
296+
}
297+
});
298+
251299
JLabel lblPixelHeight = new JLabel("Image Height:");
252-
sl_contentPane.putConstraint(SpringLayout.NORTH, lblPixelHeight, 20, SpringLayout.SOUTH, lblSelectColor);
300+
sl_contentPane.putConstraint(SpringLayout.NORTH, lblPixelHeight, 20, SpringLayout.SOUTH, btnColor);
253301
sl_contentPane.putConstraint(SpringLayout.WEST, lblPixelHeight, 0, SpringLayout.WEST, lblSelectColor);
254302
contentPane.add(lblPixelHeight);
255303

@@ -370,7 +418,7 @@ public void itemStateChanged(ItemEvent e) {
370418

371419
JButton btnOutput = new JButton("Output Directory");
372420
sl_contentPane.putConstraint(SpringLayout.WEST, btnOutput, 150, SpringLayout.WEST, contentPane);
373-
sl_contentPane.putConstraint(SpringLayout.SOUTH, btnOutput, -40, SpringLayout.NORTH, btnGen);
421+
sl_contentPane.putConstraint(SpringLayout.SOUTH, btnOutput, -45, SpringLayout.NORTH, btnGen);
374422
sl_contentPane.putConstraint(SpringLayout.EAST, btnOutput, -150, SpringLayout.EAST, contentPane);
375423
contentPane.add(btnOutput);
376424

@@ -382,8 +430,8 @@ public void itemStateChanged(ItemEvent e) {
382430
contentPane.add(separator_1);
383431

384432
JLabel lblCurrentOutput = new JLabel("Current Output:");
385-
sl_contentPane.putConstraint(SpringLayout.NORTH, lblCurrentOutput, 45, SpringLayout.SOUTH, separator_1);
386-
sl_contentPane.putConstraint(SpringLayout.WEST, lblCurrentOutput, 0, SpringLayout.WEST, scrollPane);
433+
sl_contentPane.putConstraint(SpringLayout.NORTH, lblCurrentOutput, 15, SpringLayout.SOUTH, btnOutput);
434+
sl_contentPane.putConstraint(SpringLayout.WEST, lblCurrentOutput, 10, SpringLayout.WEST, contentPane);
387435
lblCurrentOutput.setFont(new Font("Lucida Grande", Font.BOLD, 13));
388436
contentPane.add(lblCurrentOutput);
389437

@@ -394,7 +442,7 @@ public void itemStateChanged(ItemEvent e) {
394442
lblOutput.setFont(new Font("Dialog", Font.PLAIN, 12));
395443
lblOutput.setBackground(Color.WHITE);
396444
contentPane.add(lblOutput);
397-
445+
398446
btnOutput.addActionListener(new ActionListener() {
399447
public void actionPerformed(ActionEvent e) {
400448
OUTPUTPATH = FileSelection.getOutputDir(fc);

0 commit comments

Comments
 (0)