Skip to content

Commit

Permalink
fix: UI for windows
Browse files Browse the repository at this point in the history
Some changes to UI under Windows:
+ Use WindowsLookAndFeel.
+ Remove table background color.
+ Set table font.
  • Loading branch information
hliang committed Apr 16, 2020
1 parent 74ea389 commit 786c890
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ FqHash is a GUI tool to check the integrity of sequence data. It can:
+ Count number of sequences in fastq file
+ Verify the original checksum, and highlight any mismatch

![FqHash Screenshot](https://raw.githubusercontent.com/hliang/hliang.github.io/master/img/FqHash.png)
![FqHash Screenshot](https://raw.githubusercontent.com/hliang/hliang.github.io/master/img/FqHash-Win.png)

## Running FqHash
<em>Requirement: Java Runtime Environment (JRE) 8+</em>

Download the jar file and simply double-click it.

## Using FqHash
1. Add files/folder. If a folder is chosen, all sequence files inside will be added to the table.
2. Select "Count Sequences" if needed.
3. Click "Analyze" to start processing.
4. After calculation is done, enter original MD5 checksum values to verify them.

22 changes: 19 additions & 3 deletions src/io/github/hliang/FqHash/FqHashApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Vector;
import java.awt.event.ActionEvent;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.UIManager;

public class FqHashApp extends JFrame {

public static final String VERSION = "0.1";
public static final String VERSION = "0.1.1";

private JPanel contentPane;
private JButton btnAdd;
Expand All @@ -72,6 +74,11 @@ public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
System.out.println("Look and Feel not set");;
}
FqHashApp frame = new FqHashApp();
frame.setVisible(true);
} catch (Exception e) {
Expand Down Expand Up @@ -301,9 +308,17 @@ public Class<?> getColumnClass(int columnIndex) {
table.setFillsViewportHeight(true);
table.setCellSelectionEnabled(true);
table.setOpaque(false);
table.setBackground(new Color(255, 255, 230));
// table.setBackground(new Color(255, 255, 230));
table.setGridColor(Color.lightGray);
table.setFont(new Font("Monospaced", Font.PLAIN, 12));
// set font
String OS = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (OS.contains("win")) {
table.setFont(new Font("Consolas", Font.PLAIN, 12));
} else if (OS.contains("mac")) {
table.setFont(new Font("Monospaced", Font.PLAIN, 12));
} else if (OS.contains("nux")) {
table.setFont(new Font("DejaVu Sans Mono", Font.PLAIN, 12));
}

// tool tips when mouse hovers over table header
ToolTipHeader tooltipHeader = new ToolTipHeader(table.getColumnModel());
Expand Down Expand Up @@ -338,6 +353,7 @@ protected void setValue(Object value) {
}
}

table.setIntercellSpacing(new Dimension (10, 1));
scrollPane = new JScrollPane(table);

resultPanel.add(scrollPane);
Expand Down

0 comments on commit 786c890

Please sign in to comment.