rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); | scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); | sessions.addMouseListener(new MouseAdapter() { | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
sessions.addMouseListener(new MouseAdapter() { | public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } | }); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
}); | if (e.getValueIsAdjusting()) return; | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { | ListSelectionModel lsm = (ListSelectionModel) e.getSource(); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
if (e.getValueIsAdjusting()) return; | if (lsm.isSelectionEmpty()) { editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); | int selectedRow = lsm.getMinSelectionIndex(); editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
if (lsm.isSelectionEmpty()) { editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { | configOptions.setLayout(borderLayout); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
int selectedRow = lsm.getMinSelectionIndex(); editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); | sessionPanel.setLayout(borderLayout); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
configOptions.setLayout(borderLayout); | configOptions.add(sessionPanel, BorderLayout.CENTER); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
sessionPanel.setLayout(borderLayout); | sessionOpts.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); sessionOpts.add(scrollPane, BorderLayout.CENTER); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
configOptions.add(sessionPanel, BorderLayout.CENTER); | sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
sessionOpts.add(scrollPane, BorderLayout.CENTER); | addOptButton(LangTool.getString("ss.optAdd"), "ADD", sessionOptPanel); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); | removeButton = addOptButton( LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); | editButton = addOptButton( LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } | } | private void createSessionsPanel() { // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // This will make the connect dialog react to two clicks instead of having // to click on the selection and then clicking twice sessions.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { doActionConnect(); } } }); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); } |
setResizable(true); | setResizable(false); | void jbInit() throws Exception { // make it non resizable setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // create sessions panel createSessionsPanel(); // create emulator options panel createEmulatorOptionsPanel(); // create the button options createButtonOptions(); JTabbedPane optionTabs = new JTabbedPane(); optionTabs.addChangeListener(this); optionTabs.addTab(LangTool.getString("ss.labelConnections"),sessionPanel); optionTabs.addTab(LangTool.getString("ss.labelOptions1"),emulOptPanel); // add the panels to our dialog getContentPane().add(optionTabs,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // set default selection value as the first row or default session if (sessions.getRowCount() > 0) { int selInterval = 0; for (int x = 0; x < sessions.getRowCount(); x++) { if (((Boolean)ctm.getValueAt(x,2)).booleanValue()) selInterval = x; } sessions.getSelectionModel().setSelectionInterval(selInterval,selInterval); } // Oh man what a pain in the ass. Had to add a window listener to request // focus of the sessions list. addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { sessions.requestFocus(); } }); } }); // now show the world what we and they can do this.setVisible(true); } |
JTabbedPane p = (JTabbedPane)e.getSource(); int index = p.getSelectedIndex(); if (!p.getTitleAt(index).equals(LangTool.getString("ss.labelConnections"))) connectButton.setEnabled(false); else connectButton.setEnabled(true); } | JTabbedPane p = (JTabbedPane) e.getSource(); int index = p.getSelectedIndex(); if (!p .getTitleAt(index) .equals(LangTool.getString("ss.labelConnections"))) { connectButton.setEnabled(false); this.setTitle(LangTool.getString("ss.title") + " - " + LangTool.getString("ss.labelOptions1")); } else { this.setTitle(LangTool.getString("ss.title") + " - " + LangTool.getString("ss.labelConnections")); connectButton.setEnabled(true); } } | public void stateChanged(ChangeEvent e) { JTabbedPane p = (JTabbedPane)e.getSource(); int index = p.getSelectedIndex(); if (!p.getTitleAt(index).equals(LangTool.getString("ss.labelConnections"))) connectButton.setEnabled(false); else connectButton.setEnabled(true); } |
public abstract void startSystemPlugins() throws PluginException; | public abstract void startSystemPlugins(List descriptors) throws PluginException; | public abstract void startSystemPlugins() throws PluginException; |
if (instance == null) | if (instances == null) instances = new HashMap(); Object o = instances.get(component); MetalTreeUI instance; if (o == null) { | public static ComponentUI createUI(JComponent component) { if (instance == null) instance = new MetalTreeUI(); return instance; } |
instances.put(component, instance); } else instance = (MetalTreeUI) o; | public static ComponentUI createUI(JComponent component) { if (instance == null) instance = new MetalTreeUI(); return instance; } |
|
String text = ""; | public void paintComponent(Graphics g) { super.paintComponent(g); if (iconOnly) { Rectangle bounds = getBounds(); int x = (bounds.width - comboIcon.getIconWidth()) / 2; int y = (bounds.height - comboIcon.getIconHeight()) / 2; comboIcon.paintIcon(comboBox, g, x, y); } else { String text = ""; Object selected = comboBox.getModel().getSelectedItem(); if (selected != null) text = selected.toString(); Rectangle bounds = comboBox.getBounds(); Rectangle innerArea = SwingUtilities.calculateInnerArea(this, null); if (comboBox.hasFocus()) { g.setColor(MetalLookAndFeel.getFocusColor()); g.drawRect(innerArea.x, innerArea.y - 1, innerArea.width - 1, innerArea.height); } Insets insets = comboBox.getInsets(); int iconX = bounds.width - insets.right - comboIcon.getIconWidth() - 7; int iconY = insets.top + (bounds.height - comboIcon.getIconHeight()) / 2; comboIcon.paintIcon(comboBox, g, iconX, iconY); if (comboBox.isEnabled()) g.setColor(MetalLookAndFeel.getBlack()); else g.setColor(MetalLookAndFeel.getControlDisabled()); Rectangle viewArea = new Rectangle(innerArea.x, innerArea.y, innerArea.width - comboIcon.getIconWidth() - 7, innerArea.height); FontMetrics fm = g.getFontMetrics(comboBox.getFont()); Rectangle textR = new Rectangle(); text = SwingUtilities.layoutCompoundLabel(fm, text, null, SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT, viewArea, new Rectangle(), textR, 0); // FIXME: this truncation should be done within layoutCompoundLabel() text = truncateText(text, innerArea.width - comboIcon.getIconWidth() - 7, fm); int yAdj = fm.getDescent() + fm.getLeading(); g.setFont(comboBox.getFont()); g.drawString(text, textR.x, textR.y + textR.height - yAdj); } } |
|
if (selected != null) text = selected.toString(); | if (selected == null) selected = ""; | public void paintComponent(Graphics g) { super.paintComponent(g); if (iconOnly) { Rectangle bounds = getBounds(); int x = (bounds.width - comboIcon.getIconWidth()) / 2; int y = (bounds.height - comboIcon.getIconHeight()) / 2; comboIcon.paintIcon(comboBox, g, x, y); } else { String text = ""; Object selected = comboBox.getModel().getSelectedItem(); if (selected != null) text = selected.toString(); Rectangle bounds = comboBox.getBounds(); Rectangle innerArea = SwingUtilities.calculateInnerArea(this, null); if (comboBox.hasFocus()) { g.setColor(MetalLookAndFeel.getFocusColor()); g.drawRect(innerArea.x, innerArea.y - 1, innerArea.width - 1, innerArea.height); } Insets insets = comboBox.getInsets(); int iconX = bounds.width - insets.right - comboIcon.getIconWidth() - 7; int iconY = insets.top + (bounds.height - comboIcon.getIconHeight()) / 2; comboIcon.paintIcon(comboBox, g, iconX, iconY); if (comboBox.isEnabled()) g.setColor(MetalLookAndFeel.getBlack()); else g.setColor(MetalLookAndFeel.getControlDisabled()); Rectangle viewArea = new Rectangle(innerArea.x, innerArea.y, innerArea.width - comboIcon.getIconWidth() - 7, innerArea.height); FontMetrics fm = g.getFontMetrics(comboBox.getFont()); Rectangle textR = new Rectangle(); text = SwingUtilities.layoutCompoundLabel(fm, text, null, SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT, viewArea, new Rectangle(), textR, 0); // FIXME: this truncation should be done within layoutCompoundLabel() text = truncateText(text, innerArea.width - comboIcon.getIconWidth() - 7, fm); int yAdj = fm.getDescent() + fm.getLeading(); g.setFont(comboBox.getFont()); g.drawString(text, textR.x, textR.y + textR.height - yAdj); } } |
Insets insets = comboBox.getInsets(); | public void paintComponent(Graphics g) { super.paintComponent(g); if (iconOnly) { Rectangle bounds = getBounds(); int x = (bounds.width - comboIcon.getIconWidth()) / 2; int y = (bounds.height - comboIcon.getIconHeight()) / 2; comboIcon.paintIcon(comboBox, g, x, y); } else { String text = ""; Object selected = comboBox.getModel().getSelectedItem(); if (selected != null) text = selected.toString(); Rectangle bounds = comboBox.getBounds(); Rectangle innerArea = SwingUtilities.calculateInnerArea(this, null); if (comboBox.hasFocus()) { g.setColor(MetalLookAndFeel.getFocusColor()); g.drawRect(innerArea.x, innerArea.y - 1, innerArea.width - 1, innerArea.height); } Insets insets = comboBox.getInsets(); int iconX = bounds.width - insets.right - comboIcon.getIconWidth() - 7; int iconY = insets.top + (bounds.height - comboIcon.getIconHeight()) / 2; comboIcon.paintIcon(comboBox, g, iconX, iconY); if (comboBox.isEnabled()) g.setColor(MetalLookAndFeel.getBlack()); else g.setColor(MetalLookAndFeel.getControlDisabled()); Rectangle viewArea = new Rectangle(innerArea.x, innerArea.y, innerArea.width - comboIcon.getIconWidth() - 7, innerArea.height); FontMetrics fm = g.getFontMetrics(comboBox.getFont()); Rectangle textR = new Rectangle(); text = SwingUtilities.layoutCompoundLabel(fm, text, null, SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT, viewArea, new Rectangle(), textR, 0); // FIXME: this truncation should be done within layoutCompoundLabel() text = truncateText(text, innerArea.width - comboIcon.getIconWidth() - 7, fm); int yAdj = fm.getDescent() + fm.getLeading(); g.setFont(comboBox.getFont()); g.drawString(text, textR.x, textR.y + textR.height - yAdj); } } |
|
if (comboBox.isEnabled()) g.setColor(MetalLookAndFeel.getBlack()); else g.setColor(MetalLookAndFeel.getControlDisabled()); Rectangle viewArea = new Rectangle(innerArea.x, innerArea.y, innerArea.width - comboIcon.getIconWidth() - 7, innerArea.height); FontMetrics fm = g.getFontMetrics(comboBox.getFont()); Rectangle textR = new Rectangle(); text = SwingUtilities.layoutCompoundLabel(fm, text, null, SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT, viewArea, new Rectangle(), textR, 0); text = truncateText(text, innerArea.width - comboIcon.getIconWidth() - 7, fm); int yAdj = fm.getDescent() + fm.getLeading(); g.setFont(comboBox.getFont()); g.drawString(text, textR.x, textR.y + textR.height - yAdj); } } | } } | public void paintComponent(Graphics g) { super.paintComponent(g); if (iconOnly) { Rectangle bounds = getBounds(); int x = (bounds.width - comboIcon.getIconWidth()) / 2; int y = (bounds.height - comboIcon.getIconHeight()) / 2; comboIcon.paintIcon(comboBox, g, x, y); } else { String text = ""; Object selected = comboBox.getModel().getSelectedItem(); if (selected != null) text = selected.toString(); Rectangle bounds = comboBox.getBounds(); Rectangle innerArea = SwingUtilities.calculateInnerArea(this, null); if (comboBox.hasFocus()) { g.setColor(MetalLookAndFeel.getFocusColor()); g.drawRect(innerArea.x, innerArea.y - 1, innerArea.width - 1, innerArea.height); } Insets insets = comboBox.getInsets(); int iconX = bounds.width - insets.right - comboIcon.getIconWidth() - 7; int iconY = insets.top + (bounds.height - comboIcon.getIconHeight()) / 2; comboIcon.paintIcon(comboBox, g, iconX, iconY); if (comboBox.isEnabled()) g.setColor(MetalLookAndFeel.getBlack()); else g.setColor(MetalLookAndFeel.getControlDisabled()); Rectangle viewArea = new Rectangle(innerArea.x, innerArea.y, innerArea.width - comboIcon.getIconWidth() - 7, innerArea.height); FontMetrics fm = g.getFontMetrics(comboBox.getFont()); Rectangle textR = new Rectangle(); text = SwingUtilities.layoutCompoundLabel(fm, text, null, SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT, viewArea, new Rectangle(), textR, 0); // FIXME: this truncation should be done within layoutCompoundLabel() text = truncateText(text, innerArea.width - comboIcon.getIconWidth() - 7, fm); int yAdj = fm.getDescent() + fm.getLeading(); g.setFont(comboBox.getFont()); g.drawString(text, textR.x, textR.y + textR.height - yAdj); } } |
} | private void updateSelection(boolean controlPressed) { // Update the rows int lo_row = table.rowAtPoint(begin); int hi_row = table.rowAtPoint(curr); ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) { if (controlPressed && rowModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) rowModel.addSelectionInterval(lo_row, hi_row); else rowModel.setSelectionInterval(lo_row, hi_row); } // Update the columns int lo_col = table.columnAtPoint(begin); int hi_col = table.columnAtPoint(curr); ListSelectionModel colModel = table.getColumnModel(). getSelectionModel(); if (lo_col != -1 && hi_col != -1) { if (controlPressed && colModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) colModel.addSelectionInterval(lo_col, hi_col); else colModel.setSelectionInterval(lo_col, hi_col); } } |
|
} | void advanceMultipleSelection (ListSelectionModel firstModel, int firstMin, int firstMax, ListSelectionModel secondModel, int secondMin, int secondMax, boolean reverse, boolean eventIsTab) { // If eventIsTab, all the "firsts" correspond to columns, otherwise, to rows // "seconds" correspond to the opposite int firstLead = firstModel.getLeadSelectionIndex(); int secondLead = secondModel.getLeadSelectionIndex(); int numFirsts = eventIsTab ? table.getModel().getColumnCount() : table.getModel().getRowCount(); int numSeconds = eventIsTab ? table.getModel().getRowCount() : table.getModel().getColumnCount(); // check if we have to wrap the "firsts" around, going to the other side if ((firstLead == firstMax && !reverse) || (reverse && firstLead == firstMin)) { firstModel.addSelectionInterval(reverse ? firstMax : firstMin, reverse ? firstMax : firstMin); // check if we have to wrap the "seconds" if ((secondLead == secondMax && !reverse) || (reverse && secondLead == secondMin)) secondModel.addSelectionInterval(reverse ? secondMax : secondMin, reverse ? secondMax : secondMin); // if we're not wrapping the seconds, we have to find out where we // are within the secondModel and advance to the next cell (or // go back to the previous cell if reverse == true) else { int[] secondsSelected; if (eventIsTab && table.getRowSelectionAllowed() || !eventIsTab && table.getColumnSelectionAllowed()) secondsSelected = eventIsTab ? table.getSelectedRows() : table.getSelectedColumns(); else { // if row selection is not allowed, then the entire column gets // selected when you click on it, so consider ALL rows selected secondsSelected = new int[numSeconds]; for (int i = 0; i < numSeconds; i++) secondsSelected[i] = i; } // and now find the "next" index within the model int secondIndex = reverse ? secondsSelected.length - 1 : 0; if (!reverse) while (secondsSelected[secondIndex] <= secondLead) secondIndex++; else while (secondsSelected[secondIndex] >= secondLead) secondIndex--; // and select it - updating the lead selection index secondModel.addSelectionInterval(secondsSelected[secondIndex], secondsSelected[secondIndex]); } } // We didn't have to wrap the firsts, so just find the "next" first // and select it, we don't have to change "seconds" else { int[] firstsSelected; if (eventIsTab && table.getColumnSelectionAllowed() || !eventIsTab && table.getRowSelectionAllowed()) firstsSelected = eventIsTab ? table.getSelectedColumns() : table.getSelectedRows(); else { // if selection not allowed, consider ALL firsts to be selected firstsSelected = new int[numFirsts]; for (int i = 0; i < numFirsts; i++) firstsSelected[i] = i; } int firstIndex = reverse ? firstsSelected.length - 1 : 0; if (!reverse) while (firstsSelected[firstIndex] <= firstLead) firstIndex++; else while (firstsSelected[firstIndex] >= firstLead) firstIndex--; firstModel.addSelectionInterval(firstsSelected[firstIndex], firstsSelected[firstIndex]); secondModel.addSelectionInterval(secondLead, secondLead); } } |
|
if (gap != null) y += gap.height; | public void paint(Graphics gfx, JComponent ignored) { int ncols = table.getColumnCount(); int nrows = table.getRowCount(); if (nrows == 0 || ncols == 0) return; Rectangle clip = gfx.getClipBounds(); TableColumnModel cols = table.getColumnModel(); int height = table.getRowHeight(); int x0 = 0, y0 = 0; int x = x0; int y = y0; Dimension gap = table.getIntercellSpacing(); int ymax = clip.y + clip.height; int xmax = clip.x + clip.width; // paint the cell contents for (int c = 0; c < ncols && x < xmax; ++c) { y = y0; TableColumn col = cols.getColumn(c); int width = col.getWidth(); int modelCol = col.getModelIndex(); for (int r = 0; r < nrows && y < ymax; ++r) { Rectangle bounds = new Rectangle(x, y, width, height); if (bounds.intersects(clip)) { TableCellRenderer rend = table.getCellRenderer(r, c); Component comp = table.prepareRenderer(rend, r, c); gfx.translate(x, y); comp.setBounds(new Rectangle(0, 0, width, height)); // Set correct border on cell renderer. // Only the lead selection cell gets a border if (comp instanceof JComponent) { if (table.getSelectionModel().getLeadSelectionIndex() == r && table.getColumnModel().getSelectionModel(). getLeadSelectionIndex() == c) ((JComponent) comp).setBorder(highlightCellBorder); else ((JComponent) comp).setBorder(cellBorder); } comp.paint(gfx); if (comp instanceof JTextField) ((JTextField)comp).getCaret().paint(gfx); gfx.translate(-x, -y); } y += height; if (gap != null) y += gap.height; } x += width; if (gap != null) x += gap.width; } // tighten up the x and y max bounds ymax = y; xmax = x; Color grid = table.getGridColor(); // paint vertical grid lines if (grid != null && table.getShowVerticalLines()) { x = x0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int c = 0; c < ncols && x < xmax; ++c) { x += cols.getColumn(c).getWidth();; if (gap != null) x += gap.width; gfx.drawLine(x, y0, x, ymax); paintedLine = true; } gfx.setColor(save); } // paint horizontal grid lines if (grid != null && table.getShowHorizontalLines()) { y = y0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int r = 0; r < nrows && y < ymax; ++r) { y += height; if (gap != null) y += gap.height; gfx.drawLine(x0, y, xmax, y); paintedLine = true; } gfx.setColor(save); } } |
|
if (gap != null) x += gap.width; | public void paint(Graphics gfx, JComponent ignored) { int ncols = table.getColumnCount(); int nrows = table.getRowCount(); if (nrows == 0 || ncols == 0) return; Rectangle clip = gfx.getClipBounds(); TableColumnModel cols = table.getColumnModel(); int height = table.getRowHeight(); int x0 = 0, y0 = 0; int x = x0; int y = y0; Dimension gap = table.getIntercellSpacing(); int ymax = clip.y + clip.height; int xmax = clip.x + clip.width; // paint the cell contents for (int c = 0; c < ncols && x < xmax; ++c) { y = y0; TableColumn col = cols.getColumn(c); int width = col.getWidth(); int modelCol = col.getModelIndex(); for (int r = 0; r < nrows && y < ymax; ++r) { Rectangle bounds = new Rectangle(x, y, width, height); if (bounds.intersects(clip)) { TableCellRenderer rend = table.getCellRenderer(r, c); Component comp = table.prepareRenderer(rend, r, c); gfx.translate(x, y); comp.setBounds(new Rectangle(0, 0, width, height)); // Set correct border on cell renderer. // Only the lead selection cell gets a border if (comp instanceof JComponent) { if (table.getSelectionModel().getLeadSelectionIndex() == r && table.getColumnModel().getSelectionModel(). getLeadSelectionIndex() == c) ((JComponent) comp).setBorder(highlightCellBorder); else ((JComponent) comp).setBorder(cellBorder); } comp.paint(gfx); if (comp instanceof JTextField) ((JTextField)comp).getCaret().paint(gfx); gfx.translate(-x, -y); } y += height; if (gap != null) y += gap.height; } x += width; if (gap != null) x += gap.width; } // tighten up the x and y max bounds ymax = y; xmax = x; Color grid = table.getGridColor(); // paint vertical grid lines if (grid != null && table.getShowVerticalLines()) { x = x0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int c = 0; c < ncols && x < xmax; ++c) { x += cols.getColumn(c).getWidth();; if (gap != null) x += gap.width; gfx.drawLine(x, y0, x, ymax); paintedLine = true; } gfx.setColor(save); } // paint horizontal grid lines if (grid != null && table.getShowHorizontalLines()) { y = y0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int r = 0; r < nrows && y < ymax; ++r) { y += height; if (gap != null) y += gap.height; gfx.drawLine(x0, y, xmax, y); paintedLine = true; } gfx.setColor(save); } } |
|
x += cols.getColumn(c).getWidth();; if (gap != null) x += gap.width; gfx.drawLine(x, y0, x, ymax); | x += cols.getColumn(c).getWidth(); gfx.drawLine(x - gap.width, y0, x - gap.width, ymax); | public void paint(Graphics gfx, JComponent ignored) { int ncols = table.getColumnCount(); int nrows = table.getRowCount(); if (nrows == 0 || ncols == 0) return; Rectangle clip = gfx.getClipBounds(); TableColumnModel cols = table.getColumnModel(); int height = table.getRowHeight(); int x0 = 0, y0 = 0; int x = x0; int y = y0; Dimension gap = table.getIntercellSpacing(); int ymax = clip.y + clip.height; int xmax = clip.x + clip.width; // paint the cell contents for (int c = 0; c < ncols && x < xmax; ++c) { y = y0; TableColumn col = cols.getColumn(c); int width = col.getWidth(); int modelCol = col.getModelIndex(); for (int r = 0; r < nrows && y < ymax; ++r) { Rectangle bounds = new Rectangle(x, y, width, height); if (bounds.intersects(clip)) { TableCellRenderer rend = table.getCellRenderer(r, c); Component comp = table.prepareRenderer(rend, r, c); gfx.translate(x, y); comp.setBounds(new Rectangle(0, 0, width, height)); // Set correct border on cell renderer. // Only the lead selection cell gets a border if (comp instanceof JComponent) { if (table.getSelectionModel().getLeadSelectionIndex() == r && table.getColumnModel().getSelectionModel(). getLeadSelectionIndex() == c) ((JComponent) comp).setBorder(highlightCellBorder); else ((JComponent) comp).setBorder(cellBorder); } comp.paint(gfx); if (comp instanceof JTextField) ((JTextField)comp).getCaret().paint(gfx); gfx.translate(-x, -y); } y += height; if (gap != null) y += gap.height; } x += width; if (gap != null) x += gap.width; } // tighten up the x and y max bounds ymax = y; xmax = x; Color grid = table.getGridColor(); // paint vertical grid lines if (grid != null && table.getShowVerticalLines()) { x = x0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int c = 0; c < ncols && x < xmax; ++c) { x += cols.getColumn(c).getWidth();; if (gap != null) x += gap.width; gfx.drawLine(x, y0, x, ymax); paintedLine = true; } gfx.setColor(save); } // paint horizontal grid lines if (grid != null && table.getShowHorizontalLines()) { y = y0; Color save = gfx.getColor(); gfx.setColor(grid); boolean paintedLine = false; for (int r = 0; r < nrows && y < ymax; ++r) { y += height; if (gap != null) y += gap.height; gfx.drawLine(x0, y, xmax, y); paintedLine = true; } gfx.setColor(save); } } |
Object.class.getProtectionDomain() }; | protDomain }; | Class generate(ClassLoader loader) { byte[] bytecode = new byte[pool.length() + stream.length()]; // More efficient to bypass calling charAt() repetitively. char[] c = pool.toString().toCharArray(); int i = c.length; while (--i >= 0) bytecode[i] = (byte) c[i]; c = stream.toString().toCharArray(); i = c.length; int j = bytecode.length; while (i > 0) bytecode[--j] = (byte) c[--i]; // Patch the constant pool size, which we left at 0 earlier. int count = poolEntries.size() + 1; bytecode[8] = (byte) (count >> 8); bytecode[9] = (byte) count; try { Class vmClassLoader = Class.forName("java.lang.VMClassLoader"); Class[] types = {ClassLoader.class, String.class, byte[].class, int.class, int.class, ProtectionDomain.class }; Method m = vmClassLoader.getDeclaredMethod("defineClass", types); // We can bypass the security check of setAccessible(true), since // we're in the same package. m.flag = true; Object[] args = {loader, qualName, bytecode, new Integer(0), new Integer(bytecode.length), Object.class.getProtectionDomain() }; Class clazz = (Class) m.invoke(null, args); // Finally, initialize the m field of the proxy class, before // returning it. Field f = clazz.getDeclaredField("m"); f.flag = true; // we can share the array, because it is not publicized f.set(null, methods); return clazz; } catch (Exception e) { // assert false; throw (Error) new InternalError("Unexpected: " + e).initCause(e); } } |
public Throwable getException() { return getCause(); | public Throwable getException() { return exception; | public Throwable getException() { return getCause(); } |
super(); | public Separator() { } |
|
Dimension size = this.getPreferredSize(); | Dimension size = this.getSize(); | public void setVisible(boolean visible) { if (visible == isVisible()) return; boolean old = isVisible(); this.visible = visible; if (old != isVisible()) { firePropertyChange("visible", old, isVisible()); if (visible) { firePopupMenuWillBecomeVisible(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); Dimension screenSize = getToolkit().getScreenSize(); boolean fit = true; Dimension size = this.getPreferredSize(); if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; if (lightWeightPopupEnabled && fit) popup = new LightWeightPopup(this); else { if (fit) popup = new MediumWeightPopup(this); else { popup = new HeavyWeightPopup(this); setLightWeightPopupEnabled(false); } } if (popup instanceof LightWeightPopup || popup instanceof MediumWeightPopup) { JLayeredPane layeredPane; layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane(); Point p = new Point(popupLocation.x, popupLocation.y); if (layeredPane.isShowing()) SwingUtilities.convertPointFromScreen(p, layeredPane); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(p.x, p.y, size.width, size.height); } else { // Subtract insets of the top-level container if popup menu's // top-left corner is inside it. Insets insets = rootContainer.getInsets(); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(popupLocation.x - insets.left, popupLocation.y - insets.top, size.width, size.height); } } else { firePopupMenuWillBecomeInvisible(); popup.hide(); } } } |
; | protected void loadImage(Image image) { try { tracker.addImage(image, id); id++; tracker.waitForID(id - 1); } catch (InterruptedException ex) { ; // ignore this for now } finally { loadStatus = tracker.statusID(id - 1, false); } } |
|
resolvedStyles = new HashMap(); | public StyleSheet() { super(); baseFontSize = 4; // Default font size from CSS } |
|
attr.addAttribute(key, value); | Object val = CSS.getValue(key, value); attr.addAttribute(key, val); | public void addCSSAttribute(MutableAttributeSet attr, CSS.Attribute key, String value) { attr.addAttribute(key, value); } |
CssParser cp = new CssParser(); try { cp.parse(base, new StringReader(rule), false, false); } catch (IOException io) { } | public void addRule(String rule) { CssParser cp = new CssParser(); try { cp.parse(base, new StringReader(rule), false, false); } catch (IOException io) { // Do nothing here. } } |
|
return super.getBackground(a); | CSSColor c = (CSSColor) a.getAttribute(CSS.Attribute.BACKGROUND_COLOR); Color color = null; if (c != null) color = c.getValue(); return color; | public Color getBackground(AttributeSet a) { return super.getBackground(a); } |
return super.getFont(a); | FontSize size = (FontSize) a.getAttribute(CSS.Attribute.FONT_SIZE); int realSize = 12; if (size != null) realSize = size.getValue(); Object valign = a.getAttribute(CSS.Attribute.VERTICAL_ALIGN); if (valign != null) { String v = valign.toString(); if (v.contains("sup") || v.contains("sub")) realSize -= 2; } String family = "SansSerif"; int style = Font.PLAIN; FontWeight weight = (FontWeight) a.getAttribute(CSS.Attribute.FONT_WEIGHT); if (weight != null) style |= weight.getValue(); FontStyle fStyle = (FontStyle) a.getAttribute(CSS.Attribute.FONT_STYLE); if (fStyle != null) style |= fStyle.getValue(); return new Font(family, style, realSize); | public Font getFont(AttributeSet a) { return super.getFont(a); } |
return super.getForeground(a); | CSSColor c = (CSSColor) a.getAttribute(CSS.Attribute.COLOR); Color color = null; if (c != null) color = c.getValue(); return color; | public Color getForeground(AttributeSet a) { return super.getForeground(a); } |
return null; | ArrayList path = new ArrayList(); Element el; AttributeSet atts; for (el = e; el != null; el = el.getParentElement()) path.add(el); StringBuilder selector = new StringBuilder(); int count = path.size(); for (int i = count - 1; i > 0; i--) { el = (Element) path.get(i); atts = el.getAttributes(); Object name = atts.getAttribute(StyleConstants.NameAttribute); selector.append(name.toString()); if (atts.isDefined(HTML.Attribute.ID)) { selector.append('#'); selector.append(atts.getAttribute(HTML.Attribute.ID)); } else if (atts.isDefined(HTML.Attribute.CLASS)) { selector.append('.'); selector.append(atts.getAttribute(HTML.Attribute.CLASS)); } selector.append(' '); } selector.append(t.toString()); el = (Element) path.get(0); atts = el.getAttributes(); if (el.isLeaf()) { Object o = atts.getAttribute(t); if (o instanceof AttributeSet) atts = (AttributeSet) o; else atts = null; } if (atts != null) { if (atts.isDefined(HTML.Attribute.ID)) { selector.append('#'); selector.append(atts.getAttribute(HTML.Attribute.ID)); } else if (atts.isDefined(HTML.Attribute.CLASS)) { selector.append('.'); selector.append(atts.getAttribute(HTML.Attribute.CLASS)); } } return getResolvedStyle(selector.toString(), path, t); | public Style getRule(HTML.Tag t, Element e) { // FIXME: Not implemented. return null; } |
return null; | return new ViewAttributeSet(v, this); | public AttributeSet getViewAttributes(View v) { // FIXME: Not implemented. return null; } |
CssParser cp = new CssParser(); cp.parse(ref, in, false, false); | CSSStyleSheetParserCallback cb = new CSSStyleSheetParserCallback(); CSSParser parser = new CSSParser(in, cb); parser.parse(); | public void loadRules(Reader in, URL ref) throws IOException { CssParser cp = new CssParser(); cp.parse(ref, in, false, false); } |
public Color stringToColor(String color) | public Color stringToColor(String colorName) | public Color stringToColor(String color) { color = color.toLowerCase(); if (color.equals("black") || color.equals("#000000")) return Color.BLACK; else if (color.equals("aqua") || color.equals("#00FFFF")) return new Color(127, 255, 212); else if (color.equals("gray") || color.equals("#808080")) return Color.GRAY; else if (color.equals("navy") || color.equals("#000080")) return new Color(0, 0, 128); else if (color.equals("silver") || color.equals("#C0C0C0")) return Color.LIGHT_GRAY; else if (color.equals("green") || color.equals("#008000")) return Color.GREEN; else if (color.equals("olive") || color.equals("#808000")) return new Color(128, 128, 0); else if (color.equals("teal") || color.equals("#008080")) return new Color(0, 128, 128); else if (color.equals("blue") || color.equals("#0000FF")) return Color.BLUE; else if (color.equals("lime") || color.equals("#00FF00")) return new Color(0, 255, 0); else if (color.equals("purple") || color.equals("#800080")) return new Color(128, 0, 128); else if (color.equals("white") || color.equals("#FFFFFF")) return Color.WHITE; else if (color.equals("fuchsia") || color.equals("#FF00FF")) return Color.MAGENTA; else if (color.equals("maroon") || color.equals("#800000")) return new Color(128, 0, 0); else if (color.equals("Red") || color.equals("#FF0000")) return Color.RED; else if (color.equals("Yellow") || color.equals("#FFFF00")) return Color.YELLOW; return null; } |
color = color.toLowerCase(); if (color.equals("black") || color.equals("#000000")) return Color.BLACK; else if (color.equals("aqua") || color.equals("#00FFFF")) return new Color(127, 255, 212); else if (color.equals("gray") || color.equals("#808080")) return Color.GRAY; else if (color.equals("navy") || color.equals("#000080")) return new Color(0, 0, 128); else if (color.equals("silver") || color.equals("#C0C0C0")) return Color.LIGHT_GRAY; else if (color.equals("green") || color.equals("#008000")) return Color.GREEN; else if (color.equals("olive") || color.equals("#808000")) return new Color(128, 128, 0); else if (color.equals("teal") || color.equals("#008080")) return new Color(0, 128, 128); else if (color.equals("blue") || color.equals("#0000FF")) return Color.BLUE; else if (color.equals("lime") || color.equals("#00FF00")) return new Color(0, 255, 0); else if (color.equals("purple") || color.equals("#800080")) return new Color(128, 0, 128); else if (color.equals("white") || color.equals("#FFFFFF")) return Color.WHITE; else if (color.equals("fuchsia") || color.equals("#FF00FF")) return Color.MAGENTA; else if (color.equals("maroon") || color.equals("#800000")) return new Color(128, 0, 0); else if (color.equals("Red") || color.equals("#FF0000")) return Color.RED; else if (color.equals("Yellow") || color.equals("#FFFF00")) return Color.YELLOW; return null; | return CSSColor.convertValue(colorName); | public Color stringToColor(String color) { color = color.toLowerCase(); if (color.equals("black") || color.equals("#000000")) return Color.BLACK; else if (color.equals("aqua") || color.equals("#00FFFF")) return new Color(127, 255, 212); else if (color.equals("gray") || color.equals("#808080")) return Color.GRAY; else if (color.equals("navy") || color.equals("#000080")) return new Color(0, 0, 128); else if (color.equals("silver") || color.equals("#C0C0C0")) return Color.LIGHT_GRAY; else if (color.equals("green") || color.equals("#008000")) return Color.GREEN; else if (color.equals("olive") || color.equals("#808000")) return new Color(128, 128, 0); else if (color.equals("teal") || color.equals("#008080")) return new Color(0, 128, 128); else if (color.equals("blue") || color.equals("#0000FF")) return Color.BLUE; else if (color.equals("lime") || color.equals("#00FF00")) return new Color(0, 255, 0); else if (color.equals("purple") || color.equals("#800080")) return new Color(128, 0, 128); else if (color.equals("white") || color.equals("#FFFFFF")) return Color.WHITE; else if (color.equals("fuchsia") || color.equals("#FF00FF")) return Color.MAGENTA; else if (color.equals("maroon") || color.equals("#800000")) return new Color(128, 0, 0); else if (color.equals("Red") || color.equals("#FF0000")) return Color.RED; else if (color.equals("Yellow") || color.equals("#FFFF00")) return Color.YELLOW; return null; } |
return null; | AttributeSet cssAttr = htmlAttrSet.copyAttributes(); MutableAttributeSet cssStyle = addStyle(null, null); cssStyle.addAttributes(cssAttr); return cssStyle; | public AttributeSet translateHTMLToCSS(AttributeSet htmlAttrSet) { // FIXME: Not implemented. return null; } |
JMenu jMenuFile = new JMenu("File"); jMenuFile.setMnemonic('F'); JMenuItem exit = new JMenuItem("Exit"); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) { | JMenu jMenuFile = new JMenu( "File" ); jMenuFile.setMnemonic( 'F' ); JMenuItem exit = new JMenuItem( "Exit" ); exit.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ae_ ) { Thread t = new Thread( new Runnable() { public void run() { done(); } } ); | private void addMenuBar() { JMenuBar menubar = new JMenuBar(); JMenu jMenuFile = new JMenu("File"); jMenuFile.setMnemonic('F'); JMenuItem exit = new JMenuItem("Exit"); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) { done(); } }); JMenuItem eval = new JMenuItem("Evaluate"); eval.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) { evaluateText(); repaint(); } }); menubar.add(jMenuFile); jMenuFile.add(eval); jMenuFile.add(exit); setJMenuBar(menubar); } |
JMenuItem eval = new JMenuItem("Evaluate"); eval.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) { | JMenuItem reqSh = new JMenuItem( "Request Shell" ); reqSh.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ae_ ) { requestShell(); } } ); JMenuItem eval = new JMenuItem( "Evaluate" ); eval.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ae_ ) { | private void addMenuBar() { JMenuBar menubar = new JMenuBar(); JMenu jMenuFile = new JMenu("File"); jMenuFile.setMnemonic('F'); JMenuItem exit = new JMenuItem("Exit"); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) { done(); } }); JMenuItem eval = new JMenuItem("Evaluate"); eval.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) { evaluateText(); repaint(); } }); menubar.add(jMenuFile); jMenuFile.add(eval); jMenuFile.add(exit); setJMenuBar(menubar); } |
}); menubar.add(jMenuFile); jMenuFile.add(eval); jMenuFile.add(exit); | } ); menubar.add( jMenuFile ); jMenuFile.add( eval ); jMenuFile.add( exit ); jMenuFile.add( reqSh ); | private void addMenuBar() { JMenuBar menubar = new JMenuBar(); JMenu jMenuFile = new JMenu("File"); jMenuFile.setMnemonic('F'); JMenuItem exit = new JMenuItem("Exit"); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) { done(); } }); JMenuItem eval = new JMenuItem("Evaluate"); eval.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) { evaluateText(); repaint(); } }); menubar.add(jMenuFile); jMenuFile.add(eval); jMenuFile.add(exit); setJMenuBar(menubar); } |
public void actionPerformed(ActionEvent ae_) { | public void actionPerformed( ActionEvent ae_ ) { Thread t = new Thread( new Runnable() { public void run() { done(); } } ); | public void actionPerformed(ActionEvent ae_) { done(); } |
Toolkit.getDefaultToolkit().waitTillFinished(); System.err.println("Finished Charva Shell"); | System.err.println( "Finished with Done" ); pause(); | void done() { hide(); Toolkit.getDefaultToolkit().close(); Toolkit.getDefaultToolkit().waitTillFinished(); System.err.println("Finished Charva Shell"); } |
Object out = interpreter.eval(sourcecode); if (out != null) { bottomLabel.setText("Result=" + out); } else { bottomLabel.setText("Null Result."); | Object out = interpreter.eval( sourcecode ); if( out != null ) { bottomLabel.setText( "Result=" + out ); | private void evaluateText() { String sourcecode = editor.getText(); System.out.println("Evaluating source string=" + sourcecode); topLabel.setText("Evaluating..."); repaint();// Interpreter interpreter = new Interpreter(); try { Object out = interpreter.eval(sourcecode); if (out != null) { bottomLabel.setText("Result=" + out); } else { bottomLabel.setText("Null Result."); } topLabel.setText("Press F12 to Evaluate."); repaint(); } catch (EvalError evalError) { evalError.printStackTrace(); //To change body of catch statement use Options | File Templates. } } |
topLabel.setText("Press F12 to Evaluate."); | else { bottomLabel.setText( "Null Result." ); } topLabel.setText( "Press F12 to Evaluate." ); | private void evaluateText() { String sourcecode = editor.getText(); System.out.println("Evaluating source string=" + sourcecode); topLabel.setText("Evaluating..."); repaint();// Interpreter interpreter = new Interpreter(); try { Object out = interpreter.eval(sourcecode); if (out != null) { bottomLabel.setText("Result=" + out); } else { bottomLabel.setText("Null Result."); } topLabel.setText("Press F12 to Evaluate."); repaint(); } catch (EvalError evalError) { evalError.printStackTrace(); //To change body of catch statement use Options | File Templates. } } |
public static void main(String[] args) { System.err.println("Starting Charva Shell"); CharvaShell testwin = new CharvaShell(); testwin.show(); Toolkit.getDefaultToolkit().waitTillFinished(); System.err.println("Finished Charva Shell"); | public static void main( String[] args ) { System.out.println( "args = " + Arrays.asList( args ) ); if( args.length == 1 && args[0].toLowerCase().equals( "debug1" ) ) { debug1(); } else { Toolkit.getDefaultToolkit().register(); System.err.println( "Starting Charva Shell" ); CharvaShell testwin = new CharvaShell(); testwin.show(); } | public static void main(String[] args) { System.err.println("Starting Charva Shell"); CharvaShell testwin = new CharvaShell(); testwin.show(); Toolkit.getDefaultToolkit().waitTillFinished(); System.err.println("Finished Charva Shell"); } |
encoding.trim(); | encoding = encoding.trim(); | private void pushURL(boolean isPE, String ename, ExternalIdentifiers ids, Reader reader, InputStream stream, String encoding, boolean doResolve) throws SAXException, IOException { boolean ignoreEncoding; String systemId; InputSource source; if (!isPE) { dataBufferFlush(); } scratch.setPublicId(ids.publicId); scratch.setSystemId(ids.systemId); // See if we should skip or substitute the entity. // If we're not skipping, resolving reports startEntity() // and updates the (handler's) stack of URIs. if (doResolve) { // assert (stream == null && reader == null && encoding == null) source = handler.resolveEntity(isPE, ename, scratch, ids.baseUri); if (source == null) { handler.warn("skipping entity: " + ename); handler.skippedEntity(ename); if (isPE) { skippedPE = true; } return; } // we might be using alternate IDs/encoding systemId = source.getSystemId(); // The following warning and setting systemId was deleted bcause // the application has the option of not setting systemId // provided that it has set the characte/byte stream. /* if (systemId == null) { handler.warn ("missing system ID, using " + ids.systemId); systemId = ids.systemId; } */ } else { // "[document]", or "[dtd]" via getExternalSubset() scratch.setCharacterStream(reader); scratch.setByteStream(stream); scratch.setEncoding(encoding); source = scratch; systemId = ids.systemId; if (handler.stringInterning) { handler.startExternalEntity(ename, systemId, "[document]" == ename); } else { handler.startExternalEntity(ename, systemId, "[document]".equals(ename)); } } // we may have been given I/O streams directly if (source.getCharacterStream() != null) { if (source.getByteStream() != null) error("InputSource has two streams!"); reader = source.getCharacterStream(); } else if (source.getByteStream() != null) { encoding = source.getEncoding(); if (encoding == null) { stream = source.getByteStream(); } else { try { reader = new InputStreamReader(source.getByteStream(), encoding); } catch (IOException e) { stream = source.getByteStream(); } } } else if (systemId == null) { error("InputSource has no URI!"); } scratch.setCharacterStream(null); scratch.setByteStream(null); scratch.setEncoding(null); // Push the existing status. pushInput(ename); // Create a new read buffer. // (Note the four-character margin) readBuffer = new char[READ_BUFFER_MAX + 4]; readBufferPos = 0; readBufferLength = 0; readBufferOverflow = -1; is = null; line = 1; column = 0; currentByteCount = 0; // If there's an explicit character stream, just // ignore encoding declarations. if (reader != null) { sourceType = INPUT_READER; this.reader = reader; tryEncodingDecl(true); return; } // Else we handle the conversion, and need to ensure // it's done right. sourceType = INPUT_STREAM; if (stream != null) { is = stream; } else { // We have to open our own stream to the URL. URL url = new URL(systemId); externalEntity = url.openConnection(); externalEntity.connect(); is = externalEntity.getInputStream(); } // If we get to here, there must be // an InputStream available. if (!is.markSupported()) { is = new BufferedInputStream(is); } // Get any external encoding label. if (encoding == null && externalEntity != null) { // External labels can be untrustworthy; filesystems in // particular often have the wrong default for content // that wasn't locally originated. Those we autodetect. if (!"file".equals(externalEntity.getURL().getProtocol())) { int temp; // application/xml;charset=something;otherAttr=... // ... with many variants on 'something' encoding = externalEntity.getContentType(); // MHK code (fix for Saxon 5.5.1/007): // protect against encoding==null if (encoding == null) { temp = -1; } else { temp = encoding.indexOf("charset"); } // RFC 2376 sez MIME text defaults to ASCII, but since the // JDK will create a MIME type out of thin air, we always // autodetect when there's no explicit charset attribute. if (temp < 0) { encoding = null; // autodetect } else { // only this one attribute if ((temp = encoding.indexOf(';')) > 0) { encoding = encoding.substring(0, temp); } if ((temp = encoding.indexOf('=', temp + 7)) > 0) { encoding = encoding.substring(temp + 1); // attributes can have comment fields (RFC 822) if ((temp = encoding.indexOf('(')) > 0) { encoding = encoding.substring(0, temp); } // ... and values may be quoted if ((temp = encoding.indexOf('"')) > 0) { encoding = encoding.substring(temp + 1, encoding.indexOf('"', temp + 2)); } encoding.trim(); } else { handler.warn("ignoring illegal MIME attribute: " + encoding); encoding = null; } } } } // if we got an external encoding label, use it ... if (encoding != null) { this.encoding = ENCODING_EXTERNAL; setupDecoding(encoding); ignoreEncoding = true; // ... else autodetect from first bytes. } else { detectEncoding(); ignoreEncoding = false; } // Read any XML or text declaration. // If we autodetected, it may tell us the "real" encoding. try { tryEncodingDecl(ignoreEncoding); } catch (UnsupportedEncodingException x) { encoding = x.getMessage(); // if we don't handle the declared encoding, // try letting a JVM InputStreamReader do it try { if (sourceType != INPUT_STREAM) { throw x; } is.reset(); readBufferPos = 0; readBufferLength = 0; readBufferOverflow = -1; line = 1; currentByteCount = column = 0; sourceType = INPUT_READER; this.reader = new InputStreamReader(is, encoding); is = null; tryEncodingDecl(true); } catch (IOException e) { error("unsupported text encoding", encoding, null); } } } |
dialog.show(); | dialog.setVisible(true); | public static void showRunScriptDialog(SessionGUI session) { JPanel rsp = new JPanel(); rsp.setLayout(new BorderLayout()); JLabel jl = new JLabel("Enter script to run"); final JTextField rst = new JTextField(); rsp.add(jl,BorderLayout.NORTH); rsp.add(rst,BorderLayout.CENTER); Object[] message = new Object[1]; message[0] = rsp; String[] options = {"Run","Cancel"}; final JOptionPane pane = new JOptionPane( message, // the dialog message array JOptionPane.QUESTION_MESSAGE, // message type JOptionPane.DEFAULT_OPTION, // option type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0]); // option that should be made into a default button // create a dialog wrapping the pane final JDialog dialog = pane.createDialog(session, // parent frame "Run Script" // dialog title ); // add the listener that will set the focus to // the desired option dialog.addWindowListener( new WindowAdapter() { public void windowOpened( WindowEvent e) { super.windowOpened( e ); // now we're setting the focus to the desired component // it's not the best solution as it depends on internals // of the OptionPane class, but you can use it temporarily // until the bug gets fixed // also you might want to iterate here thru the set of // the buttons and pick one to call requestFocus() for it rst.requestFocus(); } }); dialog.show(); // now we can process the value selected String value = (String)pane.getValue(); if (value.equals(options[0])) { // send option along with system request if (rst.getText().length() > 0) { invoke(rst.getText(),session); } } } |
clone() { | public Object clone() { | clone(){ return(ci.clone());} |
current() { | public char current() { | current(){ return(ci.current());} |
first() { | public char first() { | first(){ return(ci.first());} |
getAllAttributeKeys() { | public Set getAllAttributeKeys() { | getAllAttributeKeys(){ HashSet s = new HashSet(); if (attribs == null) return(s); for (int i = 0; i < attribs.length; i++) { if (attribs[i].begin_index > getEndIndex() || attribs[i].end_index <= getBeginIndex()) continue; Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { s.add(iter.next()); } } return(s);} |
getAttribute(AttributedCharacterIterator.Attribute attrib) { | public Object getAttribute(AttributedCharacterIterator.Attribute attrib) { | getAttribute(AttributedCharacterIterator.Attribute attrib){ if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null);} |
getAttributes() { | public Map getAttributes() { | getAttributes(){ HashMap m = new HashMap(); if (attribs == null) return(m); for (int i = 0; i < attribs.length; i++) { if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) m.putAll(attribs[i].attribs); } return(m);} |
getBeginIndex() { | public int getBeginIndex() { | getBeginIndex(){ return(ci.getBeginIndex());} |
getEndIndex() { | public int getEndIndex() { | getEndIndex(){ return(ci.getEndIndex());} |
getIndex() { | public int getIndex() { | getIndex(){ return(ci.getIndex());} |
getRunLimit() { | public int getRunLimit() { | getRunLimit(){ return(getRunLimit(getAttributes().keySet()));} |
getRunStart() { | public int getRunStart() { | getRunStart(){ return(getRunStart(getAttributes().keySet()));} |
last() { | public char last() { | last(){ return(ci.last());} |
next() { | public char next() { | next(){ return(ci.next());} |
previous() { | public char previous() { | previous(){ return(ci.previous());} |
setIndex(int index) { | public char setIndex(int index) { | setIndex(int index){ return(ci.setIndex(index));} |
super ("ISO-8859-1", new String[]{"ISO-LATIN-1"}); | super ("ISO-8859-1", new String[] { "iso-ir-100", "ISO_8859-1", "latin1", "l1", "IBM819", "CP819", "csISOLatin1", "8859_1", "ISO8859_1", "ISO_8859_1", "ibm-819", "ISO_8859-1:1987", "819" }); | ISO_8859_1 () { super ("ISO-8859-1", new String[]{"ISO-LATIN-1"}); } |
final int stackSize = thread.getStackSize(); final Object stack = helper.getStack(thread); if (stack != null) { for (int i = 0; i < stackSize; i += slotSize) { final Address child = helper.getAddress(stack, i); if (child != null) { if (heapManager.isObject(child)) { processChild(child); } } } } | thread.visit(processChildVisitor, heapManager, helper); | private void markThreadStack(VmThread thread) { // For now do it stupid, but safe, just scan the whole stack. final int stackSize = thread.getStackSize(); final Object stack = helper.getStack(thread); if (stack != null) { for (int i = 0; i < stackSize; i += slotSize) { final Address child = helper.getAddress(stack, i); if (child != null) { if (heapManager.isObject(child)) { processChild(child); } } } } } |
private void processChild(Object child) { | final void processChild(Object child) { | private void processChild(Object child) { final int gcColor = helper.getObjectColor(child); if (gcColor <= GC_WHITE) { // Yellow or White helper.atomicChangeObjectColor(child, gcColor, GC_GREY); try { // TEST for a valid vmclass. helper.getVmClass(child); stack.push(child); } catch (NullPointerException ex) { Unsafe.debug("\nObject address "); Unsafe.debug(helper.addressOf32(child)); Unsafe.debug("\nObject TIB "); Unsafe.debug(helper.addressOf32(helper.getTib(child))); helper.die("NPE in processChild; probably corrupted heap"); } } } |
t.minor = Minor.Header; | public void send(IOR ior) { try { Socket socket = new Socket(ior.Internet.host, ior.Internet.port); OutputStream socketOutput = socket.getOutputStream(); write(socketOutput); socketOutput.close(); socket.close(); } catch (IOException ex) { MARSHAL t = new MARSHAL(); t.initCause(ex); throw t; } } |
|
ActionEvent event = new ActionEvent(this, 0, actionCommand); | String command = actionCommand != null ? actionCommand : getText(); ActionEvent event = new ActionEvent(this, 0, command); | public void postActionEvent() { ActionEvent event = new ActionEvent(this, 0, actionCommand); ActionListener[] listeners = getActionListeners(); for (int index = 0; index < listeners.length; ++index) listeners[index].actionPerformed(event); } |
this.actionCommand = command; | actionCommand = command; | public void setActionCommand(String command) { this.actionCommand = command; } |
public int checkImage(Image img, int width, int height, ImageObserver o) { | public final int checkImage(Image img, int width, int height, ImageObserver o) { | public int checkImage(Image img, int width, int height, ImageObserver o) { return toolkit.checkImage(img, width, height, o); } |
public void coalescePaintEvent(PaintEvent e) { | public final void coalescePaintEvent(PaintEvent e) { | public void coalescePaintEvent(PaintEvent e) { //System.err.println( "coalescePaintEvent: " + e ); } |
public void createBuffers(int x, BufferCapabilities bufferCapabilities) { | public final void createBuffers(int x, BufferCapabilities bufferCapabilities) { | public void createBuffers(int x, BufferCapabilities bufferCapabilities) { } |
public void destroyBuffers() { | public final void destroyBuffers() { | public void destroyBuffers() { } |
public void disable() { | public final void disable() { | public void disable() { setEnabled(false); } |
void fireComponentEvent(final int oldWidth, int width, final int oldHeight, int height) { | final void fireComponentEvent(final int oldWidth, int width, final int oldHeight, int height) { | void fireComponentEvent(final int oldWidth, int width, final int oldHeight, int height) { if ((oldWidth != width) || (oldHeight != height)) { fireComponentEvent(ComponentEvent.COMPONENT_RESIZED); } else { fireComponentEvent(ComponentEvent.COMPONENT_MOVED); } } |
public FontMetrics getFontMetrics(Font font) { | public final FontMetrics getFontMetrics(Font font) { | public FontMetrics getFontMetrics(Font font) { return toolkit.getFontMetrics(font); } |
final Component parent = ((Component)component).getParent(); | final Component parent = component.getParent(); | public Graphics getGraphics() { //log.debug("getGraphics"); final Component parent = ((Component)component).getParent(); if (parent != null) { final int x = jComponent.getX(); final int y = jComponent.getY(); final int width = jComponent.getWidth(); final int height = jComponent.getHeight(); return parent.getGraphics().create(x, y, width, height); } else { throw new Error(); } } |
public GraphicsConfiguration getGraphicsConfiguration() { | public final GraphicsConfiguration getGraphicsConfiguration() { | public GraphicsConfiguration getGraphicsConfiguration() { return toolkit.getGraphicsConfiguration(); } |
return computeLocationOnScreen(((Component)component)); | return computeLocationOnScreen(component); | public Point getLocationOnScreen() { return computeLocationOnScreen(((Component)component)); } |
public boolean isFocusTraversable() { | public final boolean isFocusTraversable() { | public boolean isFocusTraversable() { return jComponent.isFocusTraversable(); } |
public boolean isFocusable() { | public final boolean isFocusable() { | public boolean isFocusable() { return jComponent.isFocusable(); } |
public boolean prepareImage(Image img, int width, int height, ImageObserver o) { | public final boolean prepareImage(Image img, int width, int height, ImageObserver o) { | public boolean prepareImage(Image img, int width, int height, ImageObserver o) { return toolkit.prepareImage(img, width, height, o); } |
SizeRequirements.calculateAlignedPositions(targetSpan, null, childReqs, | SizeRequirements total = baselineRequirements(axis, null); SizeRequirements.calculateAlignedPositions(targetSpan, total, childReqs, | protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { SizeRequirements[] childReqs = getChildRequirements(axis); // Calculate the spans and offsets using the SizeRequirements uility // methods. SizeRequirements.calculateAlignedPositions(targetSpan, null, childReqs, offsets, spans); validateLayout(axis); } |
out.write(sc.getBytes()); | for (int x = 0; x < sc.length(); x++) out.write(sc.charAt(x)); | private void writeToFile(String sc,File file) { FileOutputStream out = null; try { out = new FileOutputStream(file); out.write(sc.getBytes()); out.flush(); out.close(); } catch (FileNotFoundException fnfe) {System.out.println("fnfe: " + fnfe.getMessage());} catch (IOException ioe) {System.out.println("ioe: " + ioe.getMessage());} finally { if (out != null) try { out.close(); } catch (IOException exc) {} } } |
init(new SimpleDateFormat()); | DateEditorFormatter nef = new DateEditorFormatter(); nef.setMinimum(getModel().getStart()); nef.setMaximum(getModel().getEnd()); ftf.setFormatterFactory(new DefaultFormatterFactory(nef)); | public DateEditor(JSpinner spinner) { super(spinner); init(new SimpleDateFormat()); } |
return dateFormat; | DateFormatter formatter = (DateFormatter) ftf.getFormatter(); return (SimpleDateFormat) formatter.getFormat(); | public SimpleDateFormat getFormat() { return dateFormat; } |
ftf.addPropertyChangeListener(this); | public DefaultEditor(JSpinner spinner) { super(); setLayout(this); this.spinner = spinner; ftf = new JFormattedTextField(); add(ftf); ftf.setValue(spinner.getValue()); spinner.addChangeListener(this); } |
|
if (event.getSource() == ftf) { if (event.getPropertyName().equals("value")) spinner.getModel().setValue(event.getNewValue()); } | public void propertyChange(PropertyChangeEvent event) { // TODO: Implement this properly. } |
|
ftf.setValue(spinner.getValue()); | public void stateChanged(ChangeEvent event) { // TODO: Implement this properly. } |
|
NumberEditorFormatter nef = new NumberEditorFormatter(); nef.setMinimum(getModel().getMinimum()); nef.setMaximum(getModel().getMaximum()); ftf.setFormatterFactory(new DefaultFormatterFactory(nef)); | public NumberEditor(JSpinner spinner) { super(spinner); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.