Search in sources :

Example 26 with JTextPane

use of javax.swing.JTextPane in project Info-Evaluation by TechnionYP5777.

the class MainFrame method main.

/**
	 * Launch the application.
	 */
public static void main(final String[] args) {
    EventQueue.invokeLater(() -> {
        try {
            final MainFrame window = new MainFrame();
            /* right click in table */
            window.table.addMouseListener(new MouseAdapter() {

                @Override
                public void mousePressed(MouseEvent e) {
                    Point point = e.getPoint();
                    int currentRow = window.table.rowAtPoint(point);
                    int currentcolumn = window.table.columnAtPoint(point);
                    window.table.setRowSelectionInterval(currentRow, currentRow);
                    window.table.setColumnSelectionInterval(currentcolumn, currentcolumn);
                    window.mnprofile.setVisible(window.table.getColumnName(window.table.getSelectedColumn()) == "Name");
                }
            });
            window.mnfilter.addActionListener(l -> {
                try {
                    if (window.table.getSelectedColumn() != -1 && window.table.getSelectedRow() != -1) {
                        String columnName = window.table.getColumnName(window.table.getSelectedColumn());
                        if (columnName == "Date")
                            columnName = "Year";
                        window.inputList.filterBy((DefaultTableModel) window.table.getModel(), columnName, (String) window.table.getValueAt(window.table.getSelectedRow(), window.table.getSelectedColumn()), FilterType.RIGHT_CLICK);
                    }
                } catch (SQLException e1) {
                    e1.printStackTrace();
                    JOptionPane.showMessageDialog(null, "problem with sql connector", "Error", JOptionPane.INFORMATION_MESSAGE);
                }
            });
            window.mnprofile.addActionListener(l -> {
                JPanel pan = new JPanel();
                pan.setLayout(new FlowLayout((FlowLayout.LEFT)));
                JTextPane infoText = new JTextPane();
                String name = (String) window.table.getValueAt(window.table.getSelectedRow(), window.table.getSelectedColumn());
                infoText.setText(window.personalInfo.getCelebInfoString(name));
                infoText.setBackground(new Color(0, 0, 0, 0));
                pan.add(infoText);
                JDialog mydialog = new JDialog();
                mydialog.setSize(new Dimension(480, 290));
                mydialog.setTitle("Personal info of " + name);
                mydialog.add(pan);
                mydialog.setVisible(true);
            });
            window.frame.setVisible(true);
            window.onClickCheckBox(window.chckbxDate, window.chckbxName, window.chckbxReason);
            window.onClickCheckBox(window.chckbxName, window.chckbxDate, window.chckbxReason);
            window.onClickCheckBox(window.chckbxReason, window.chckbxName, window.chckbxDate);
            /*
				 * chckbx on click
				 * 
				 */
            window.chckbxSortby.addActionListener(l1 -> {
                window.removeSelected();
                window.comboBox.setVisible(false);
                window.txtpnChooseOneFrom.setVisible(false);
                window.chckbxFilterBy.setSelected(false);
                window.chckbxSearch.setSelected(false);
                window.searchTxt.setEditable(false);
                window.chckbxDate.setText("Date");
                window.setVisabilty(window.chckbxSortby.isSelected());
            });
            window.chckbxFilterBy.addActionListener(l2 -> {
                window.removeSelected();
                window.comboBox.setVisible(false);
                window.txtpnChooseOneFrom.setVisible(false);
                window.chckbxSortby.setSelected(false);
                window.searchTxt.setEditable(false);
                window.chckbxSearch.setSelected(false);
                window.chckbxDate.setText("Year");
                window.setVisabilty(window.chckbxFilterBy.isSelected());
            });
            window.chckbxSearch.addActionListener(l2 -> {
                window.removeSelected();
                window.setVisabilty(false);
                window.comboBox.setVisible(false);
                window.searchTxt.setText(window.chckbxSearch.isSelected() ? "" : "Select checkBox to search");
                window.txtpnChooseOneFrom.setVisible(false);
                window.chckbxSortby.setSelected(false);
                window.chckbxFilterBy.setSelected(false);
                window.searchTxt.setEditable(window.chckbxSearch.isSelected());
            });
            /*
				 * addEvent button
				 * 
				 */
            window.addEventBtnOnClick();
            /*
				 * search button onclick
				 * 
				 */
            window.btnSearch.addActionListener(e -> {
                final DefaultTableModel model = (DefaultTableModel) window.table.getModel();
                if (!window.startFlag)
                    window.btnSearch.setText("Search");
                window.startFlag = true;
                if (window.chckbxSortby.isSelected())
                    try {
                        window.inputList.sortBy(model, window.selected_chckbx());
                    } catch (final SQLException exc) {
                        JOptionPane.showMessageDialog(null, "problem with sql connector", "Error", JOptionPane.INFORMATION_MESSAGE);
                    }
                else if (!window.chckbxFilterBy.isSelected() && !window.chckbxSearch.isSelected())
                    try {
                        window.inputList.sortBy(model, "none");
                    } catch (final SQLException e11) {
                        e11.printStackTrace();
                    }
                else if (window.chckbxFilterBy.isSelected())
                    try {
                        window.inputList.filterBy((DefaultTableModel) window.table.getModel(), window.selected_chckbx(), (String) window.comboBox.getSelectedItem(), FilterType.CHOOSE_FROM_LIST);
                    } catch (final SQLException e12) {
                        e12.printStackTrace();
                    }
                else
                    try {
                        if ("".equals(window.searchTxt.getText()))
                            window.inputList.sortBy(model, "none");
                        else
                            window.inputList.filterBy((DefaultTableModel) window.table.getModel(), null, window.searchTxt.getText(), FilterType.AUTOCOMPLETE);
                    } catch (Exception e1) {
                        try {
                            window.inputList.sortBy(model, "none");
                        } catch (SQLException e2) {
                            e2.printStackTrace();
                        }
                    }
                window.table.setVisible(true);
                window.js.setVisible(true);
                window.btnLoadAnalyzeResults.setVisible(true);
            });
            /*
				 * LoadAnalyzeResults button on click
				 */
            window.btnLoadAnalyzeResults.addActionListener(l -> {
                DefaultTableModel model = (DefaultTableModel) window.table.getModel();
                try {
                    window.inputList.sortBy(model, "none");
                } catch (SQLException e1) {
                    JOptionPane.showMessageDialog(null, "problem with sql connector", "Error", JOptionPane.INFORMATION_MESSAGE);
                }
            });
            /*
				 * About
				 */
            window.mntmAbout.addActionListener(m -> JOptionPane.showMessageDialog(null, "Info Evaluation is a program that reads query results from google search and parses " + "the data,formats it,\nthen analyzes according to the query " + "and returns a structured list of info and interactively suggests" + " new\nqueries in order to achieve the most exact results. " + "\n\n\n\n\nBy: \nVivian Shehadeh\nGenia Shandalov\nOsher Hajaj" + "\nWard Mattar\nMoshiko Elisof\nNetanel Felcher\n", "About", JOptionPane.INFORMATION_MESSAGE));
        } catch (final Exception ¢) {
            ¢.printStackTrace();
        }
    });
}
Also used : JPanel(javax.swing.JPanel) MouseEvent(java.awt.event.MouseEvent) FlowLayout(java.awt.FlowLayout) SQLException(java.sql.SQLException) Color(java.awt.Color) DefaultTableModel(javax.swing.table.DefaultTableModel) MouseAdapter(java.awt.event.MouseAdapter) Point(java.awt.Point) Dimension(java.awt.Dimension) SQLException(java.sql.SQLException) IOException(java.io.IOException) JTextPane(javax.swing.JTextPane) JDialog(javax.swing.JDialog)

Example 27 with JTextPane

use of javax.swing.JTextPane in project jmeter by apache.

the class ComparisonVisualizer method getSecondaryTextPane.

private JTextPane getSecondaryTextPane() {
    secondary = new JTextPane();
    secondary.setEditable(false);
    return secondary;
}
Also used : JTextPane(javax.swing.JTextPane)

Example 28 with JTextPane

use of javax.swing.JTextPane in project jmeter by apache.

the class ComparisonVisualizer method getBaseTextPane.

private JTextPane getBaseTextPane() {
    base = new JTextPane();
    base.setEditable(false);
    base.setBackground(getBackground());
    return base;
}
Also used : JTextPane(javax.swing.JTextPane)

Example 29 with JTextPane

use of javax.swing.JTextPane in project tika by apache.

the class TikaGUI method addCard.

private JEditorPane addCard(JPanel panel, String type, String name) {
    JEditorPane editor = new JTextPane();
    editor.setBackground(Color.WHITE);
    editor.setContentType(type);
    editor.setTransferHandler(new ParsingTransferHandler(editor.getTransferHandler(), this));
    panel.add(new JScrollPane(editor), name);
    return editor;
}
Also used : JScrollPane(javax.swing.JScrollPane) JTextPane(javax.swing.JTextPane) JEditorPane(javax.swing.JEditorPane)

Example 30 with JTextPane

use of javax.swing.JTextPane in project jgnash by ccavanaugh.

the class ImportTwo method initComponents.

private void initComponents() {
    table = new ImportTable();
    deleteButton = new JButton(rb.getString("Button.Delete"));
    helpPane = new JTextPane();
    helpPane.setEditable(false);
    helpPane.setEditorKit(new StyledEditorKit());
    helpPane.setBackground(getBackground());
    helpPane.setText(TextResource.getString("ImportTwo.txt"));
    addComponentListener(new ComponentAdapter() {

        @Override
        public void componentShown(ComponentEvent evt) {
            refreshInfo();
        }
    });
    deleteButton.addActionListener(this);
    JTableUtils.packGenericTable(table);
}
Also used : StyledEditorKit(javax.swing.text.StyledEditorKit) JTextPane(javax.swing.JTextPane) JButton(javax.swing.JButton) ComponentEvent(java.awt.event.ComponentEvent) ComponentAdapter(java.awt.event.ComponentAdapter)

Aggregations

JTextPane (javax.swing.JTextPane)32 JScrollPane (javax.swing.JScrollPane)13 JButton (javax.swing.JButton)9 JLabel (javax.swing.JLabel)9 JPanel (javax.swing.JPanel)8 Color (java.awt.Color)6 Dimension (java.awt.Dimension)6 JRadioButton (javax.swing.JRadioButton)6 JTextField (javax.swing.JTextField)6 Insets (java.awt.Insets)4 IOException (java.io.IOException)4 JCheckBox (javax.swing.JCheckBox)4 JPasswordField (javax.swing.JPasswordField)4 JTable (javax.swing.JTable)4 BorderLayout (java.awt.BorderLayout)3 Component (java.awt.Component)3 FlowLayout (java.awt.FlowLayout)3 Font (java.awt.Font)3 GridBagConstraints (java.awt.GridBagConstraints)3 GridBagLayout (java.awt.GridBagLayout)3