Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static JTextField percentLine = null;
- private static String DEFAULT_PERCENT = "90.0";
- private static float percentage;
- private static JFrame errorWindow;
- private static JButton enterPercent;
- public JPanel initCustomization()
- {
- percentage = new Float(DEFAULT_PERCENT)/100;
- //new panel to contain all the elements
- JPanel percentLinePanel = new JPanel();
- //create text field for user input
- percentLine = new JTextField(5);
- percentLine.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e)
- {
- percentLine.setText(percentLine.getText());
- }
- });
- percentLine.setEditable(true);
- percentLine.setText(DEFAULT_PERCENT);
- percentLine.setPreferredSize(new Dimension(100,25));
- //create label beside text field
- JLabel percentLineLabel = new JLabel();
- percentLineLabel.setText("Enter percent line to display (1-100)%:");
- //create the confirmation button
- enterPercent = new JButton();
- enterPercent.setText("Confirm");
- enterPercent.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e)
- {
- if(checkPercent(percentLine.getText())) //check for valid input
- {
- setPercent(percentLine.getText());
- JOptionPane.showMessageDialog(errorWindow,
- (percentLine.getText()+"% Line has been set."),"Confirmation",
- JOptionPane.INFORMATION_MESSAGE);
- }
- }
- });
- enterPercent.setPreferredSize(new Dimension(80,25));
- percentLinePanel.add(percentLineLabel, BorderLayout.WEST);
- percentLinePanel.add(percentLine, BorderLayout.CENTER);
- percentLinePanel.add(enterPercent, BorderLayout.EAST);
- return percentLinePanel;
- }
- super();
- model = new ObjectTableModel(COLUMNS,
- SamplingStatCalculator.class,
- new Functor[] {
- new Functor("getLabel"), //$NON-NLS-1$
- new Functor("getCount"), //$NON-NLS-1$
- new Functor("getMeanAsNumber"), //$NON-NLS-1$
- new Functor("getMedian"), //$NON-NLS-1$
- new Functor("getPercentPoint", //$NON-NLS-1$
- new Object[] { StatVisualizerAddOn.getPercent() }), //90% line
- new Functor("getMin"), //$NON-NLS-1$
- new Functor("getMax"), //$NON-NLS-1$
- new Functor("getErrorPercentage"), //$NON-NLS-1$
- new Functor("getRate"), //$NON-NLS-1$
- new Functor("getKBPerSecond") //$NON-NLS-1$
- },
- new Functor[] { null, null, null, null, null, null, null, null, null, null },
- new Class[] { String.class, Long.class, Long.class, Long.class, Long.class,
- Long.class, Long.class, String.class, String.class, String.class });
- clearData();
- init();
- }
- addon = new StatVisualizerAddOn();
- JPanel percentile = addon.getPanel();
- mainPanel.add(percentile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement