|
| 1 | +package gov.doe.jgi.boost.ui; |
| 2 | +import javax.swing.JFrame; |
| 3 | +import javax.swing.GroupLayout; |
| 4 | +import javax.swing.GroupLayout.Alignment; |
| 5 | +import javax.swing.JLabel; |
| 6 | +import javax.swing.JRadioButton; |
| 7 | +import javax.swing.LayoutStyle.ComponentPlacement; |
| 8 | +import javax.swing.JButton; |
| 9 | + |
| 10 | +public class AvailableTasksBOOST{ |
| 11 | + |
| 12 | + private JFrame frame; |
| 13 | + private JLabel instructionText; |
| 14 | + private JRadioButton reverseTranstationBtn; |
| 15 | + private JRadioButton codonJugglingBtn; |
| 16 | + private JRadioButton sequenceModificationBtn; |
| 17 | + private JRadioButton sequencePartitionBtn; |
| 18 | + private JButton cancelButton; |
| 19 | + private JButton submitButton; |
| 20 | + |
| 21 | + public AvailableTasksBOOST() { |
| 22 | + |
| 23 | + JFrame frame = new JFrame("Abailable Operations for Sequence"); |
| 24 | + frame.setSize(500, 270); |
| 25 | + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
| 26 | + placeComponents(frame); |
| 27 | + frame.setVisible(true); |
| 28 | + } |
| 29 | + |
| 30 | + private void placeComponents(JFrame jFrame) { |
| 31 | + |
| 32 | + GroupLayout layout = new GroupLayout(jFrame.getContentPane()); |
| 33 | + jFrame.getContentPane().setLayout(layout); |
| 34 | + layout.setAutoCreateGaps(true); |
| 35 | + layout.setAutoCreateContainerGaps(true); |
| 36 | + |
| 37 | + instructionText = new JLabel("Please select the operaton(s) you want to perform with your sequence"); |
| 38 | + reverseTranstationBtn = new JRadioButton("Reverse-Translation of protein to DNA sequences"); |
| 39 | + codonJugglingBtn = new JRadioButton("Codon-Juggling of protein coding DNA sequences"); |
| 40 | + sequenceModificationBtn = new JRadioButton("Modification of protein coding sequences (\"CDS\") for efficient synthesis"); |
| 41 | + sequencePartitionBtn = new JRadioButton("Partition of large DNA sequences into synthesizable building blocks"); |
| 42 | + |
| 43 | + cancelButton = new JButton("Cancel"); |
| 44 | + submitButton = new JButton("Submit"); |
| 45 | + |
| 46 | + layout.setHorizontalGroup( |
| 47 | + layout.createParallelGroup(Alignment.LEADING) |
| 48 | + .addGroup(layout.createParallelGroup(Alignment.LEADING) |
| 49 | + .addComponent(sequenceModificationBtn) |
| 50 | + .addComponent(sequencePartitionBtn) |
| 51 | + .addComponent(codonJugglingBtn) |
| 52 | + .addComponent(reverseTranstationBtn) |
| 53 | + .addGroup(layout.createParallelGroup(Alignment.TRAILING, false) |
| 54 | + .addGroup(Alignment.LEADING, layout.createSequentialGroup() |
| 55 | + .addComponent(cancelButton) |
| 56 | + .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
| 57 | + .addComponent(submitButton)) |
| 58 | + .addComponent(instructionText, Alignment.LEADING)))); |
| 59 | + |
| 60 | + layout.setVerticalGroup( |
| 61 | + layout.createParallelGroup(Alignment.LEADING) |
| 62 | + .addGroup(layout.createSequentialGroup() |
| 63 | + .addGap(26) |
| 64 | + .addComponent(instructionText) |
| 65 | + .addGap(28) |
| 66 | + .addComponent(reverseTranstationBtn) |
| 67 | + .addPreferredGap(ComponentPlacement.UNRELATED) |
| 68 | + .addComponent(codonJugglingBtn) |
| 69 | + .addPreferredGap(ComponentPlacement.UNRELATED) |
| 70 | + .addComponent(sequenceModificationBtn) |
| 71 | + .addPreferredGap(ComponentPlacement.UNRELATED) |
| 72 | + .addComponent(sequencePartitionBtn) |
| 73 | + .addPreferredGap(ComponentPlacement.RELATED, 37, Short.MAX_VALUE) |
| 74 | + .addGroup(layout.createParallelGroup(Alignment.BASELINE) |
| 75 | + .addComponent(cancelButton) |
| 76 | + .addComponent(submitButton)) |
| 77 | + .addGap(29))); |
| 78 | + |
| 79 | + jFrame.pack(); |
| 80 | + jFrame.setLocationRelativeTo(null); |
| 81 | + jFrame.setResizable(true); |
| 82 | + } |
| 83 | +} |
0 commit comments