- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 3
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Hi! I'm trying to improve a code shown below. My idea is to add multiple images to JPanel. It sounds like an easy task, but all my attempts failed so far. I tried to create [ICODE]Image image2 = getToolkit().getImage(Drag1.class.getResource("cross_cursor.gif"));[/ICODE] and then [ICODE]bi2 = new BufferedImage(image2.getWidth(this), image2.getHeight(this)...);[/ICODE]. But I can see … |
|
Hi! I'd like to check if a string contains spaces: [CODE]System.out.println(text2.getText().matches("\\s+"));[/CODE] This code returns 'false' for both "My string" and "MyString". But I need 'true' for "MySpace". How could I do this? Thanks! |
|
Hi! I'm trying to create a method for simultaneous dragging a group of JLabel components. First, I select the components to be dragged ([ICODE]getSelectedStatus() -> true[/ICODE]), and then I want to be able to drag the selected components. I have a working method for a single JLabel component, but there … |
|
Hi! I'm a newbie in JSP and, therefore, my question could be totally incorrect. Sorry for this. So, I've developed a Java SWING application that is actually the image processing tool. Is it possible to update this software to a web-application? For example, could I place Java classes in WEB-INF/classes/, … |
|
Hi! Please, tell me how to make the JDialog close button working in a proper way. Now it does not work. [ICODE]System.out.println(value);[/ICODE] produces 0. But if I write [ICODE]if (value == 0)[/ICODE], then nothing happens. Any ideas? Thanks! [CODE] public static void about() { final JOptionPane optionPane = new JOptionPane( … |
|
Hi! I would like to read XML file from my SWING application, however [ICODE]list.size()[/ICODE] returns 0. Why does it happen? Thanks! [CODE] private void open() { SAXBuilder builder = new SAXBuilder(); File xmlFile = new File(openedFileName()); try{ Document document = (Document) builder.build(xmlFile); Element rootNode = document.getRootElement(); List list = rootNode.getChildren("Panel"); … |
|
Hi! I would like to select images by using a rectangular area. All images that are inside this area, must be selected. I want this area to appear while mouse clicking and dragging. So, the size of a rectangular area should change dynamically according to a position of the mouse … |
|
Hi! I need my own file extension for SWING desktop application (image processing tool). In fact, I want a user to be able to save locations of JLabel components on a screen. Please, give me a hint on how to implement this task. Thanks! |
|
Hi! I'm trying to create borders around JLabel components. However, the line [ICODE]c[i].setBorder(border)[/ICODE] cannot be compiled. Please, help me to improve this code. Thanks! [CODE] public void mouseReleased(MouseEvent e) { if (Menu.getgroup()) { Component[] c = getComponents(); Border border = LineBorder.createGrayLineBorder(); for(int i = 0; i < c.length; i++) { … |
|
Hi! I would like to create a button for deleting all JLabel components on JDesktopPane. My code is shown below. The error message is shown below the code. For instance, let's say there are 3 JLabel components (the 4th is not JLabel). In this case, only 2 of 3 JLabel … |
|
Hi! I would like to make transparent my two JScrollPane components. Could please someone explain me why the code [ICODE] scrollPane1.setOpaque(false); scrollPane2.setOpaque(false); imagePanel.setOpaque(false); beads.setOpaque(false);[/ICODE] does not work? Thanks! [CODE] public SelectablePanel() { beads = new BeadsCollection(NR_OF_BEADS); imagePanel = new ImageSelectionPanel(0, NR_OF_BEADS_SIZE); p = new Point(); JInternalFrame jif = new JInternalFrame("Title", … |
|
Hi! Could someone please give me any idea on how to add a background image to JInternalFrame without subclassing. Below I provide a code snippet, but the line [ICODE]jif.setBackgroundImage(backImage);[/ICODE] is incorrect. Please, help me to fix this error. But I don't want to create a subclass, e.g. MyJInternalFrame. Thanks! [CODE] … |
|
Hi! I am working on scaling the image that is placed in JLabel. The scaling method itself works more or less fine, however a black border appears around the image after scaling. I tried to make the transparent/white JLabel background, but my attempts failed. Please explain me how could I … |
|
Hi! I'm trying to zoom in/out ImageIcon in JLabel. The problem is that after 2-3 zooming actions, the image quality becomes horrible. How could I solve this problem? Thanks! [CODE] private void doZoom(int scaleFactor) { Component[] c = SelectablePanel.getMainPanel().getComponents(); for(int i = 0; i < c.length; i++) { if(c[i] instanceof … |
|
Hi! How could I change custom cursor size? I was playing with Point(a,b), however the cursor is always 32x32 and it looks horribly. Below you can see my code snippet. Thanks! [CODE] Toolkit toolkit = Toolkit.getDefaultToolkit(); Image imageCrossCursor = toolkit.getImage(BeadToolbarColor.class.getResource("/icons/cross_cursor.png")); cross_cursor = toolkit.createCustomCursor(imageCrossCursor, new Point(0,0), "Cross cursor"); panel.setCursor(cross_cursor); [/CODE] |
|
Hi! I created JToolBar, but it is always attached to JPanel. If I run my api, then I can drag and drop JToolBar in order to separate it from JPanel. I want to programmatically make JToolBar to look as a separate window (e.g. as a toolbar in Photoshop). Does anybody … |
|
Hi! There is JPanel with multiple JLabel components. I would like to change the border color of JLabel component that is clicked on. I tried [ICODE]this.getComponentAt(e.getX(), e.getY()).setBorder(solidBorder)[/ICODE], but it did not work... How could I solve this task? |
|
Hi! I'm trying to add dragging and dropping behaviour to JLabel. It works only when I press the mouse for the first time. If I continue pressing the mouse, the error message shown below is generated. Please, help me to find an error. [CODE] JLabel bkg = new JLabel(icon); jLayeredPane.add(bkg, … |
|
Hi! I would like to zoom in & zoom out an image in JLayeredPane. Now I have a snippet for loading a background image into JLayeredPane. How could I now access ALL content images of JLayeredPane (it could contain multiple images) and zoom them in/out? Perhaps, somebody could send me … |
|
Hi! I would like to make a JFrame that will play a role of a toolbar. It can be dragged and dropped within a specified area. So, I don't know how to specify the area for dragging and dropping. Could anybody help me? Thanks! |
|
Hi! I'm new to Android OS and all this stuff. So, I tried to develop a HelloAndroid api as it is described [URL="http://developer.android.com/resources/tutorials/hello-world.html"]here[/URL]. However, when I try to Run the HelloAndroid, the error message occurs. It is also strange that by selecting Run->Run, the "Android Application" option does not appear … |
|
Hi! My JAVA+MySQL api worked fine yesterday, but today (when I try to connect to MySQL DB from remote machine) the fllowing erro is produced: [ICODE]Java Result: -805306369[/ICODE]. Although there is e.prinstachtrace() in my code, I received only this message. It happens here: [CODE] db = (Connection) DriverManager.getConnection("jdbc:mysql://" + url … |
|
Hi! My JTable is populated from remote DB. I would like to set column names from the DB table column "of_shortTitle". However, if I run query "select * from OrgFolders" then column names are taken from "of_title" by default. The table model is given below. How could I set column … |
|
Hi! I would like to change the string: [ICODE]"reg_num, reg_date, attached_file, Description"[/ICODE] to the new string: [ICODE]"reg_num, reg_date, Description, attached_file"[/ICODE]. So, what I need is to search the substring "attached_file" and put in at the end of the main string. How could I do that? Thanks! |
|
Hi! Could someone tell me please how to configure MySQL DB for storing both latin and cyrillic data sets in the same table? Thanks! |
|
Hi! I have a Java application that works with MySQL DB. Until today I used latin alphabet, but now I would like to extend my application to working with cyrillic alphabet. As far as I know, it is possible to use UTF-8. But I don't know the way, in which … |
|
Hi! I would like to create textfields that will serve for sorting data in JTable, and the width of these textfields will correspond to a column width. So, below you may see the code that worked until I did not use an array of textfields. Now, the size of [ICODE]txtRegNum[/ICODE] … |
|
Hi! When I try to run the code [ICODE]tableModel.setQuery("select l_code, l_title, l_description from Lists");[/ICODE], then I receive the following error: [CODE] java.lang.ArrayIndexOutOfBoundsException: 0 >= 0 at java.util.Vector.elementAt(Vector.java:427) at SystClasses.QueryTableModel.getValueAt(QueryTableModel.java:72) at SystClasses.QueryTableModel.getColumnClass(QueryTableModel.java:53) at javax.swing.table.TableRowSorter.useToString(TableRowSorter.java:224) at javax.swing.DefaultRowSorter.updateUseToString(DefaultRowSorter.java:607) at javax.swing.DefaultRowSorter.sort(DefaultRowSorter.java:556) at javax.swing.DefaultRowSorter.allChanged(DefaultRowSorter.java:816) at javax.swing.DefaultRowSorter.modelStructureChanged(DefaultRowSorter.java:826) at javax.swing.JTable.tableChanged(JTable.java:4364) at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280) at SystClasses.QueryTableModel.setQuery(QueryTableModel.java:110) at SystClasses.Form.createAdminTable(Form.java:747) at … |
|
Hello! My JTree is filled from DB. If I add a new node, and then try to delete it, then the code shown below provides an error. As I see, selectedFolder is sometimes null. Why does it happen? Why [ICODE]getLastSelectedPathComponent()[/ICODE] doesn't return a node selected, but returns null in some … |
|
Hi! I want to delete an empty directory from FTP Server, however my code works only for files. Let's say the root directory in my FTP Server is called as [ICODE]Documents[/ICODE]. I want to delete a directory [ICODE]Director[/ICODE]. Then I execute [ICODE]client.deleteFile("\\" + selectedPath);[/ICODE], where [ICODE]selectedPath[/ICODE] is equal to [ICODE]Documents\Correspondence\Finance\Director[/ICODE]. … |