/** Description of the Method */ public void init() { // super.init(); size = new Dimension(570, 570); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); Dimension d = messagePanel.getSize(); d.height += 20; messagePanel.setPreferredSize(d); contentPane.add(messagePanel, BorderLayout.SOUTH); contentPane.setOpaque(true); userPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); messagePanel.setLayout(borderLayout5); contentPane.setOpaque(true); contentPane.setBackground(Color.white); this.setSize(size); messagePanel.add(labelMessage, BorderLayout.NORTH); // Logg.logg("MhClient: Före XttTree-skapande", 6); this.mhTable = new MhTable(root, false, this.labelMessage); // Logg.logg("MhClient: mhTable-skapande klart", 6); this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER); }
/** * Basic nonparametric usage of canny edge detector. No thresholding is used. * * @param original input image */ public CCannyEdgeDetector(BufferedImage original) { size = new Dimension(original.getWidth(), original.getHeight()); input = original.getData(); image = new BufferedImage( (int) size.getWidth(), (int) size.getHeight(), BufferedImage.TYPE_INT_RGB); bands = original.getSampleModel().getNumBands(); }
/** * Prepare a buffer for the image, return if the canvas is ready Only need to call this when the * size of the canvas is changed, Since we automatically detect the size change in paint() only * call this on start */ public boolean newImgBuf() { Dimension sz = getSize(); if (sz.width == 0 || sz.height == 0) return false; // quit if the current image already has the right size if (img != null && imgG != null && sz.equals(imgSize)) return true; img = createImage(sz.width, sz.height); if (imgG != null) imgG.dispose(); imgG = img.getGraphics(); imgSize = sz; return true; }
@Override public void paintDone(PlanarImage image, Rectangle visibleRect, boolean synchronous, long time) { if (image == null) return; Dimension previewDimension = getSize(); if ((previewDimension.getHeight() > 1) && (previewDimension.getWidth() > 1)) { this.visibleRect = visibleRect; currentImage = new SoftReference<PlanarImage>(image); preview = null; repaint(); } }
public synchronized boolean imageUpdate( Image a_image, int a_flag, int a_x, int a_y, int a_width, int a_height) { if ((a_flag & WIDTH) != 0) m_size.width = a_width; if ((a_flag & HEIGHT) != 0) m_size.height = a_height; if ((a_flag & (ERROR | ABORT)) != 0) m_isImcomplete = true; boolean retval = !resultKnown(); if (!retval) { notifyAll(); } // if return retval; }
@Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { textLabel.setFont(table.getFont()); textLabel.setText(Objects.toString(value, "")); textLabel.setBorder(hasFocus ? focusCellHighlightBorder : noFocusBorder); FontMetrics fm = table.getFontMetrics(table.getFont()); Insets i = textLabel.getInsets(); int swidth = iconLabel.getPreferredSize().width + fm.stringWidth(textLabel.getText()) + i.left + i.right; int cwidth = table.getColumnModel().getColumn(column).getWidth(); dim.width = swidth > cwidth ? cwidth : swidth; if (isSelected) { textLabel.setOpaque(true); textLabel.setForeground(table.getSelectionForeground()); textLabel.setBackground(table.getSelectionBackground()); iconLabel.setIcon(sicon); } else { textLabel.setOpaque(false); textLabel.setForeground(table.getForeground()); textLabel.setBackground(table.getBackground()); iconLabel.setIcon(nicon); } return panel; }
public FileNameRenderer(JTable table) { Border b = UIManager.getBorder("Table.noFocusBorder"); if (Objects.isNull(b)) { // Nimbus??? Insets i = focusCellHighlightBorder.getBorderInsets(textLabel); b = BorderFactory.createEmptyBorder(i.top, i.left, i.bottom, i.right); } noFocusBorder = b; p.setOpaque(false); panel.setOpaque(false); // http://www.icongalore.com/ XP Style Icons - Windows Application Icon, Software XP Icons nicon = new ImageIcon(getClass().getResource("wi0063-16.png")); sicon = new ImageIcon( p.createImage( new FilteredImageSource(nicon.getImage().getSource(), new SelectedImageFilter()))); iconLabel = new JLabel(nicon); iconLabel.setBorder(BorderFactory.createEmptyBorder()); p.add(iconLabel, BorderLayout.WEST); p.add(textLabel); panel.add(p, BorderLayout.WEST); Dimension d = iconLabel.getPreferredSize(); dim.setSize(d); table.setRowHeight(d.height); }
@Override public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); Insets ins = getInsets(); if (bSmallTitle) { if (getOrientation().isHorizontal()) { d.height = 16 + 2 + ins.top + ins.bottom; } else { d.width = 16 + 2 + ins.left + ins.right; } } else { if (getOrientation().isHorizontal()) { d.height = 16 + 2 + ins.top + ins.bottom; } else { d.width = 16 + 2 + ins.left + ins.right; } } return d; }
@Override protected BufferedImage doInBackground() { int x, y, b; int[] A = null; int[] sum = new int[bands], sum_x = new int[bands], sum_y = new int[bands]; WritableRaster raster = image.getRaster(); for (x = 0; x < size.getWidth(); x++) { for (y = 0; y < size.getHeight(); y++) { if (y == 0 || y == size.getHeight() - 1 || x == 0 || x == size.getWidth() - 1) { for (b = 0; b < bands; b++) { sum[b] = 0; } } else { for (b = 0; b < bands; b++) { A = input.getSamples( x - 1, y - 1, CSobelOperator.matrix_size, CSobelOperator.matrix_size, b, A); sum_x[b] = CSobelOperator.getGx(A); sum_y[b] = CSobelOperator.getGy(A); } for (b = 0; b < bands; b++) { sum[b] = Math.abs(sum_x[b]) + Math.abs(sum_y[b]); } } raster.setPixel(x, y, sum); setProgress( 100 * (x * ((int) size.getHeight()) + y) / ((int) (size.getWidth() * size.getHeight()))); } } image.setData(raster); return image; }
/** * Method declaration * * @param ev */ public void actionPerformed(ActionEvent ev) { String s = ev.getActionCommand(); if (s == null) { if (ev.getSource() instanceof MenuItem) { MenuItem i; s = ((MenuItem) ev.getSource()).getLabel(); } } if (s.equals("Execute")) { execute(); } else if (s.equals("Exit")) { windowClosing(null); } else if (s.equals("Transfer")) { Transfer.work(null); } else if (s.equals("Dump")) { Transfer.work(new String[] {"-d"}); /* NB - 26052002 Restore is not implemented yet in the transfer tool */ /* } else if (s.equals("Restore")) { Transfer.work(new String[]{"-r"}); */ } else if (s.equals("Logging on")) { jdbcSystem.setLogToSystem(true); } else if (s.equals("Logging off")) { jdbcSystem.setLogToSystem(false); } else if (s.equals("Refresh Tree")) { refreshTree(); } else if (s.startsWith("#")) { int i = Integer.parseInt(s.substring(1)); txtCommand.setText(sRecent[i]); } else if (s.equals("Connect...")) { connect(ConnectionDialog.createConnection(fMain, "Connect")); refreshTree(); } else if (s.equals("Results in Grid")) { iResult = 0; pResult.removeAll(); pResult.add("Center", gResult); pResult.doLayout(); } else if (s.equals("Open Script...")) { FileDialog f = new FileDialog(fMain, "Open Script", FileDialog.LOAD); // (ulrivo): set default directory if set from command line if (defDirectory != null) { f.setDirectory(defDirectory); } f.show(); String file = f.getFile(); if (file != null) { txtCommand.setText(DatabaseManagerCommon.readFile(f.getDirectory() + file)); } } else if (s.equals("Save Script...")) { FileDialog f = new FileDialog(fMain, "Save Script", FileDialog.SAVE); // (ulrivo): set default directory if set from command line if (defDirectory != null) { f.setDirectory(defDirectory); } f.show(); String file = f.getFile(); if (file != null) { DatabaseManagerCommon.writeFile(f.getDirectory() + file, txtCommand.getText()); } } else if (s.equals("Save Result...")) { FileDialog f = new FileDialog(fMain, "Save Result", FileDialog.SAVE); // (ulrivo): set default directory if set from command line if (defDirectory != null) { f.setDirectory(defDirectory); } f.show(); String file = f.getFile(); if (file != null) { showResultInText(); DatabaseManagerCommon.writeFile(f.getDirectory() + file, txtResult.getText()); } } else if (s.equals("Results in Text")) { iResult = 1; pResult.removeAll(); pResult.add("Center", txtResult); pResult.doLayout(); showResultInText(); } else if (s.equals("AutoCommit on")) { try { cConn.setAutoCommit(true); } catch (SQLException e) { } } else if (s.equals("AutoCommit off")) { try { cConn.setAutoCommit(false); } catch (SQLException e) { } } else if (s.equals("Enlarge Tree")) { Dimension d = tTree.getMinimumSize(); d.width += 20; tTree.setMinimumSize(d); fMain.pack(); } else if (s.equals("Shrink Tree")) { Dimension d = tTree.getMinimumSize(); d.width -= 20; if (d.width >= 0) { tTree.setMinimumSize(d); } fMain.pack(); } else if (s.equals("Enlarge Command")) { txtCommand.setRows(txtCommand.getRows() + 1); fMain.pack(); } else if (s.equals("Shrink Command")) { int i = txtCommand.getRows() - 1; txtCommand.setRows(i < 1 ? 1 : i); fMain.pack(); } else if (s.equals("Commit")) { try { cConn.commit(); } catch (SQLException e) { } } else if (s.equals("Insert test data")) { insertTestData(); } else if (s.equals("Rollback")) { try { cConn.rollback(); } catch (SQLException e) { } } else if (s.equals("Disable MaxRows")) { try { sStatement.setMaxRows(0); } catch (SQLException e) { } } else if (s.equals("Set MaxRows to 100")) { try { sStatement.setMaxRows(100); } catch (SQLException e) { } } else if (s.equals("SELECT")) { showHelp(DatabaseManagerCommon.selectHelp); } else if (s.equals("INSERT")) { showHelp(DatabaseManagerCommon.insertHelp); } else if (s.equals("UPDATE")) { showHelp(DatabaseManagerCommon.updateHelp); } else if (s.equals("DELETE")) { showHelp(DatabaseManagerCommon.deleteHelp); } else if (s.equals("CREATE TABLE")) { showHelp(DatabaseManagerCommon.createTableHelp); } else if (s.equals("DROP TABLE")) { showHelp(DatabaseManagerCommon.dropTableHelp); } else if (s.equals("CREATE INDEX")) { showHelp(DatabaseManagerCommon.createIndexHelp); } else if (s.equals("DROP INDEX")) { showHelp(DatabaseManagerCommon.dropIndexHelp); } else if (s.equals("CHECKPOINT")) { showHelp(DatabaseManagerCommon.checkpointHelp); } else if (s.equals("SCRIPT")) { showHelp(DatabaseManagerCommon.scriptHelp); } else if (s.equals("SHUTDOWN")) { showHelp(DatabaseManagerCommon.shutdownHelp); } else if (s.equals("SET")) { showHelp(DatabaseManagerCommon.setHelp); } else if (s.equals("Test Script")) { showHelp(DatabaseManagerCommon.testHelp); } }
public ImageSizer(Image a_image) { m_size.width = a_image.getWidth(m_observer); m_size.height = a_image.getHeight(m_observer); }
public NetworkMapPanel(Hacker hacker, MapPanel mapPanel) { Dimension mapsize = mapPanel.networkPanel.getSize(); double h = mapsize.getHeight(); System.out.println(h); float multi = 400; HashMap<String, NetworkButton> networks = new HashMap<String, NetworkButton>(); networks.put( "UGOPNet", new NetworkButton( "UGOPNet", 3.0f, 2.25f, 1.1f, new Color(0, 0, 204), "images/browserhome.png", hacker, multi)); networks.put( "SubNet", new NetworkButton( "SubNet", 3.0f, 3.5f, 1, new Color(0, 0, 150), "images/down.png", hacker, multi)); networks.put( "ProgNet", new NetworkButton( "ProgNet", 3.5f, 3.0f, 1, new Color(0, 0, 150), "images/script.png", hacker, multi)); networks.put( "DarkNet", new NetworkButton( "DarkNet", 3.0f, 4.0f, 0.9f, new Color(50, 50, 50), "images/exit.png", hacker, multi)); networks.put( "LunarMicrosystems", new NetworkButton( "LunarMicrosystems", 2, 4.5f, 1, new Color(0, 153, 255), "images/cpu.png", hacker, multi)); networks.put( "DoSC", new NetworkButton( "DoSC", 2.25f, 3.25f, 1, new Color(0, 0, 204), "images/firewall.png", hacker, multi)); networks.put( "DTNet", new NetworkButton( "DTNet", 2.0f, 2.0f, 1, new Color(100, 100, 100), "images/ducttape.png", hacker, multi)); networks.put( "GeNet", new NetworkButton( "GeNet", 1.0f, 2.0f, 1, new Color(100, 100, 100), "images/germanium.png", hacker, multi)); networks.put( "SiNet", new NetworkButton( "SiNet", 1.0f, 3.0f, 1, new Color(100, 100, 100), "images/silicon.png", hacker, multi)); networks.put( "YBCONet", new NetworkButton( "YBCONet", 0.5f, 2.5f, 1, new Color(100, 100, 100), "images/YBCO.png", hacker, multi)); networks.put( "PuNet", new NetworkButton( "PuNet", 0, 2.0f, 0.8f, new Color(100, 100, 100), "images/plutonium.png", hacker, multi)); networks.put( "UND", new NetworkButton( "UND", 3.5f, 3.5f, 1, new Color(0, 0, 204), "images/firewall.png", hacker, multi)); networks.put( "UniversityNet", new NetworkButton( "UniversityNet", 4.5f, 2.0f, 1.0f, new Color(0, 0, 204), "images/browser.png", hacker, multi)); networks.put( "DoSCDataBank", new NetworkButton( "DoSCDatabank", 1.75f, 2.5f, 1.3f, new Color(0, 0, 204), "images/compile.png", hacker, multi)); networks.put( "DoSCBank", new NetworkButton( "DoSCBank", 2.5f, 2.0f, 1, new Color(0, 0, 204), "images/bank.png", hacker, multi)); networks.put( "ArenaNet", new NetworkButton( "ArenaNet", 4.5f, 3.0f, 1, new Color(204, 0, 0), "images/attack.png", hacker, multi)); networks.put( "TheArena", new NetworkButton( "TheArena", 4.0f, 4.0f, 1, new Color(204, 0, 0), "images/attack.png", hacker, multi)); networks.put( "LunarCreditUnion", new NetworkButton( "LunarCreditUnion", 2.5f, 4, 1, new Color(0, 153, 255), "images/pettycash.png", hacker, multi)); networks.put( "SpyNet", new NetworkButton( "SpyNet", 3.0f, 4.0f, 1, new Color(200, 200, 200), "images/watchIcon.png", hacker, multi)); networks.put( "LunarDatabank", new NetworkButton( "LunarDatabank", 1.0f, 4.5f, 1.4f, new Color(0, 153, 255), "images/bank.png", hacker, multi)); networks.put( "LunarCorporate", new NetworkButton( "LunarCorporate", 0, 6.0f, 1, new Color(0, 153, 255), "images/hd.png", hacker, multi)); networks.put( "LunarLabs", new NetworkButton( "LunarLabs", 2.5f, 5.0f, 1, new Color(0, 153, 255), "images/repair.png", hacker, multi)); networks.put( "LunarSpecOps", new NetworkButton( "LunarSpecOps", 1f, 6.0f, 1, new Color(0, 153, 255), "images/watchIcon.png", hacker, multi)); networks.put( "LunarSat", new NetworkButton( "LunarSat", 0.25f, 5.0f, 1, new Color(0, 153, 255), "images/scan.png", hacker, multi)); networks.put( "LunarColonies", new NetworkButton( "LunarColonies", 1.0f, 5.5f, 1, new Color(0, 153, 255), "images/new.png", hacker, multi)); networks.put( "UGoPIntranet", new NetworkButton( "UGoPIntranet", 2.5f, 1, 1, new Color(0, 0, 204), "images/http.png", hacker, multi)); networks.put( "UGoPCorporate", new NetworkButton( "UGoPCorporate", 3.0f, 0, 1, new Color(0, 0, 204), "images/hd.png", hacker, multi)); networks.put( "UGoPDatabank", new NetworkButton( "UGoPDatabank", 2.75f, 1.5f, 1.2f, new Color(0, 0, 204), "images/compile.png", hacker, multi)); networks.put( "UGoPVault", new NetworkButton( "UGoPVault", 3.0f, 1.0f, 1, new Color(0, 0, 204), "images/bank.png", hacker, multi)); networks.put( "TerrorNet", new NetworkButton( "TerrorNet", 5.5f, 5.0f, 0.9f, new Color(204, 0, 0), "images/refresh.png", hacker, multi)); networks.put( "TerrorStash", new NetworkButton( "TerrorStash", 4.5f, 4.5f, 1, new Color(204, 0, 0), "images/bank.png", hacker, multi)); networks.put( "TerrorWeaponsNet", new NetworkButton( "TerrorWeaponsNet", 5.0f, 4.0f, 1, new Color(204, 0, 0), "images/attack.png", hacker, multi)); networks.put( "TerrorLeaders", new NetworkButton( "TerrorLeaders", 6, 6.0f, 0.75f, new Color(204, 0, 0), "images/firewall.png", hacker, multi)); networks.put( "InnerCircle", new NetworkButton( "InnerCircle", 6, 0, 0.5f, new Color(150, 0, 100), "images/decompile.png", hacker, multi)); networks.put( "LawNet", new NetworkButton( "LawNet", 4.0f, 1.5f, 0.75f, new Color(150, 0, 100), "images/redirect.png", hacker, multi)); networks.put( "GroundZero", new NetworkButton( "GroundZero", 3.0f, 5.5f, 1, new Color(200, 200, 200), "images/ports.png", hacker, multi)); networks.put( "Wastelands", new NetworkButton( "Wastelands", 3.5f, 4.5f, 1.2f, new Color(204, 0, 0), "images/attack.png", hacker, multi)); networks.put( "JuniperPenetentiary", new NetworkButton( "JuniperPenetentiary", 7, 0, 0.75f, new Color(150, 0, 100), "images/firewall.png", hacker, multi)); this.nodeList = networks; this.hacker = hacker; this.mapPanel = mapPanel; try { back = ImageLoader.getImage("images/NetMapFull.png"); } catch (Exception e) { } setLayout(null); setBackground(MapPanel.NETWORK_INFO_BACKGROUND); setPreferredSize(new Dimension(back.getWidth(), back.getHeight())); populate(); }