Search Results

Search found 159 results on 7 pages for 'jtable'.

Page 7/7 | < Previous Page | 3 4 5 6 7 

  • Java/Swing: Problem with key listener

    - by Mike
    I have a search dialog with a JTextField that's being used as a search box. When the user types something, it searches the DB, shows the result in a JTable and selects the first item in it. If the first result is what they were looking for, I want to let them quickly accept the dialog, by pressing Enter (while the JTextField is focused). So I added a KeyListener to the JTextField and it's working OK. Now the problem: The user opens can open the dialog by pressing Enter when a "Search" button on the dialog's parent frame is focused. The dialog is displayed and the JTextField gets the keyReleased event (from the Enter key that displayed it), so it shows up and closes. If the user holds Enter down, then the JTextField receives the keyPressed, keyTyped and keyReleased events. How can I fix without resorting to ugly workarounds? Platform is Windows 7 x64, btw. Test NetBeans project here: http://dl.dropbox.com/u/6354360/KeyListenerTest.zip Thanks.

    Read the article

  • search data from FileReader in Java

    - by maya
    hi I'm new in java how to read and search data from file (txt) and then display the data in TextArea or Jtable. for example I have file txt contains data and I need to display this data in textarea after I clicked a button, I have used FileReader , and t1 t2 tp are attributes in the file import java.io.FileReader; import java.io.IOException; String t1,t2,tp; Ffile f1= new Ffile(); FileReader fin = new FileReader("test2.txt"); Scanner src = new Scanner(fin); while (src.hasNext()) { t1 = src.next(); textarea.setText(t1); t2 = src.next(); textarea.setText(t2); tp = src.next(); textarea.setText(tp); f1.insert(t1,t2,tp); } fin.close(); also I have used the inputstream DataInputStream dis = null; String dbRecord = null; try { File f = new File("text2.text"); FileInputStream fis = new FileInputStream(f); BufferedInputStream bis = new BufferedInputStream(fis); dis = new DataInputStream while ( (dbRecord = dis.readLine()) != null) { StringTokenizer st = new StringTokenizer(dbRecord, ":"); String t1 = st.nextToken(); String t2 = st.nextToken(); String tp = st.nextToken(); textarea.setText(textarea.getText()+t1); textarea.setText(textarea.getText()+t2); textarea.setText(textarea.getText()+tp); } } catch (IOException e) { // catch io errors from FileInputStream or readLine() System.out.println("Uh oh, got an IOException error: " + e.getMessage()); } finally { } but both of them don't work ,so please any one help me I want to know how to read data and also search it from file and i need to display the data in textarea . thanks in advance

    Read the article

  • JCombobox containing enum values inside a table

    - by Edan
    Hello, I have a class containing Enum with values. (names) In other class I would like to enter inside a table a cell type of JCombobox that will use these enums values. my problem is to combain between string values and the enum. for example the enum class: enum item_Type {entree, main_Meal, Dessert, Drink} for example the table class: setTitle("Add new item" ); setSize(300, 80); setBackground( Color.gray ); // Create a panel to hold all other components topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); //new JComboBox(item_Type.values()); JComboBox aaa = new JComboBox(); aaa = new JComboBox(item_Type.values()); TableColumn sportColumn = table.getColumnModel().getColumn(2); // Create columns names String columnNames[] = {"Item Description", "Item Type", "Item Price"}; // Create some data String dataValues[][] = {{ "0", aaa, "0" }}; // Create a new table instance table = new JTable( dataValues, columnNames ); // Add the table to a scrolling pane scrollPane = new JScrollPane( table ); topPanel.add( scrollPane, BorderLayout.CENTER ); I know that at the dataValues array I cant use aaa (the enum jcombobox). How can I do that? thanks in advance.

    Read the article

  • Saving tree-structures in Databases

    - by Nina Null
    Hello everyone. I use Hibernate/Spring and a MySQL Database for my data management. Currently I display a tree-structure in a JTable. A tree can have several branches, in turn a branch can have several branches (up to nine levels) again, or having leaves. Lately I have performanceproblemes, as soon as I want to create new branches on deeper levels. At this time a branch has a foreign key to its parent. The domainobject has access to its parent by calling getParent(), which returns the parent-branch. The deeper the level, the longer it takes to create a new branch. Microbenchmark results for creating a new branch are like: Level 1: 32 ms. Level 3: 80 ms. Level 9: 232 ms. Obviously the level (which means the number of parents) is responsible for this. So I wanted to ask, if there are any appendages to work around this kind of problem. I don’t understand why Hibernate needs to know about the whole object tree (all parents until the root) while creating a new branch. But as far as I know this can be the only reason for the delay while creating a new branch, because a branch doesn’t have any other relations to any other objects. I would be very thankful for any workarounds or suggestions. greets, jambusa

    Read the article

  • Custom Swing component: questions on approach

    - by phatmanace
    Hi Folks, I'm trying to build a new java swing component, I realise that I might be able to find one that does what I need on the web, but this is partly an exercise for me to learn ow to do this. I want to build a swing component that represents a Gantt chart. it would be good (though not essential for people to be able to interact with it (e.g slide the the tasks around to adjust timings) it feels like the best approach for this is to subclass JComponent, and override PaintComponent() to 'draw a picture' of what the chart should look like, as opposed to doing something like trying to jam everything into a custom JTable. I've read a couple of books on the subject, and also looked at a few examples (most notably things like JXGraph) - but I'm curious about a few things When do I have to switch to using UI delegates, and when can I stick to just fiddling around in paintcomponent() to render what I want? if I want other swing components as sub-elements of my component (e.g I wanted a text box on my gantt chart) can I no longer use paintComponent()? can I arbitrarily position them within my Gantt chart, or do I have to use a normal swing layout manager many thanks in advance. -Ace

    Read the article

  • Is dependency injection only for service type objects and singletons? (and NOT for gui?)

    - by sensui
    I'm currently experimenting with the Google's guice inversion of control container. I previously had singletons for just about any service (database, active directory) my application used. Now I refactored the code: all the dependencies are given as parameters to constructors. So far, so good. Now the hardest part is with the graphical user interface. I face this problem: I have a table (JTable) of products wrapped in an ProductFrame. I give the dependencies as parameters (EditProductDialog). @Inject public ProductFrame(EditProductDialog editProductDialog) { // ... } // ... @Inject public EditProductDialog(DBProductController productController, Product product) { // ... } The problem is that guice can't know what Product I have selected in the table, so it can't know what to inject in the EditProductDialog. Dependency Injection is pretty viral (if I modify one class to use dependency injection I also need to modify all the other classes it interacts with) so my question is should I directly instantiate EditProductDialog? But then I would have to pass manually the DBProductController to the EditProductDialog and I will also need to pass it to the ProductFrame and all this boils down to not using dependency injection at all. Or is my design flawed and because of that I can't really adapt the project to dependecy injection? Give me some examples of how you used dependency injection with the graphical user interface. All the examples found on the Internet are really simple examples where you use some services (mostly databases) with dependency injection.

    Read the article

  • java /TableModel of Objects/Update Object"

    - by Tomás Ó Briain
    I've a collection of Stock objects that I'm updating about 10/15 variables for in real-time. I'm accessing each Stock by its ID in the collection. I'm also trying to display this in a JTable and have implemented an AbstractTablemodel. It's not working too well. I've a RowMap that I add each ID to as Stocks are added to the TableModel. To update the prices and variables of all the stocks in the TableModel, I want to send a Stock object to an updateModel(Stock s) method. I can find the relevant row by searching the map, but how do I handle this nicely, so I don't have to start iterating through table columns and comparing the values of the cells to the variables of the object to see whether there are any differences?? Basically, i want to send a Stock object to the TableModel and update cells if there are changes and do nothing if there aren't. Any ideas about how to implement a TableModel that might do this? Any pointeres at all would be appreciated. Thanks.

    Read the article

  • CodePlex Daily Summary for Monday, March 19, 2012

    CodePlex Daily Summary for Monday, March 19, 2012Popular ReleasesHarness: Harness 2.0.1: working on Windows 7 (x64) (not used shell32.dll) Speed ​​up operation Vista/IE7 support (x86 and x64) Minor bug fixesSCCM Client Actions Tool: SCCM Client Actions Tool v1.11: SCCM Client Actions Tool v1.11 is the latest version. It comes with following changes since last version: Fixed a bug when ping and cmd.exe kept running in endless loop after action progress was finished. Fixed update checking from Codeplex RSS feed. The tool is downloadable as a ZIP file that contains four files: ClientActionsTool.hta – The tool itself. Cmdkey.exe – command line tool for managing cached credentials. This is needed for alternate credentials feature when running the HTA...Krempel's Windows Phone 7 project: DelayLoadImage release: For documentation check; http://thewp7dev.wordpress.com The source code depends on the HTMLAgilityPack wich can be downloaded here http://htmlagilitypack.codeplex.com/SourceControl/changeset/changes/94773. And the System.Xml.XPath.dll wich is part of the Silverlight SDK and located in "C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client" or in "C:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client".SQL Monitor - managing sql server performance: SQLMon 4.2 alpha 11: 1. added process visualizer to show the internal process model of SQL Server through hierachical chart. 2. fixed a few bugs, sorry.WebSocket4Net: WebSocket4Net 0.5: Changes in this release fixed the wss's default port bug improved JsonWebSocket supported set client access policy protocol for silverlight fixed a handshake issue in Silverlight fixed a bug that "Host" field in handshake hadn't contained port if the port is not default supported passing in Origin parameter for handshaking supported reacting pings from server side fixed a bug in data sending fixed the bug sending a closing handshake with no message which would cause an excepti...SuperWebSocket, a .NET WebSocket Server: SuperWebSocket 0.5: Changes included in this release: supported closing handshake queue checking improved JSON subprotocol supported sending ping from server to client fixed a bug about sending a closing handshake with no message refactored the code to improve protocol compatibility fixed a bug about sub protocol configuration loading in Mono improved BasicSubProtocol added JsonWebSocketSessionDaun Management Studio: Daun Management Studio 0.1 (Alpha Version): These are these the alpha application packages for Daun Management Studio to manage MongoDB Server. Please visit our official website http://www.daun-project.comRiP-Ripper & PG-Ripper: RiP-Ripper 2.9.28: changes NEW: Added Support for "PixHub.eu" linksSmartNet: V1.0.0.0: DY SmartNet ?????? V1.0callisto: callisto 2.0.21: Added an option to disable local host detection.MyRouter (Virtual WiFi Router): MyRouter 1.0.6: This release should be more stable there were a few bug fixes including the x64 issue as well as an error popping up when MyRouter started this was caused by a NULL valuePulse: Pulse Beta 4: This version is still in development but should include: Logging and error handling have been greatly improved. If you run into an error or Pulse crashes make sure to check the Log folder for a recently modified log file so you can report the details of the issue A bunch of new features for the Wallbase.cc provider. Cleaner separation between inputs, downloading and output. Input and downloading are fairly clean now but outputs are still mixed up in the mix which I'm trying to resolve ...Google Books Downloader for Windows: Google Books Downloader-2.0.0.0.: Google Books DownloaderFinestra Virtual Desktops: 2.5.4501: This is a very minor update release. Please see the information about the 2.5 and 2.5.4500 releases for more information on recent changes. This update did not even have an automatic update triggered for it. Adds error checking and reporting to all threads, not only those with message loopsAcDown????? - Anime&Comic Downloader: AcDown????? v3.9.2: ?? ●AcDown??????????、??、??????,????1M,????,????,?????????????????????????。???????????Acfun、????(Bilibili)、??、??、YouTube、??、???、??????、SF????、????????????。??????AcPlay?????,??????、????????????????。 ● AcDown???????????????????????????,???,???????????????????。 ● AcDown???????C#??,????.NET Framework 2.0??。?????"Acfun?????"。 ????32??64? Windows XP/Vista/7/8 ????????????? ??:????????Windows XP???,?????????.NET Framework 2.0???(x86),?????"?????????"??? ??????????????,??????????: ??"AcDo...ArcGIS Editor for OpenStreetMap: ArcGIS Editor for OSM 2.0 Release Candidate: Your feedback is welcome - and this is your last chance to get your fixes in for this version! Includes installer for both Feature Server extension and Desktop extension, enhanced functionality for the Desktop tools, and enhanced built-in Javascript Editor for the Feature Server component. This release candidate includes fixes to beta 4 that accommodate domain users for setting up the Server Component, and fixes for reporting/uploading references tracked in the revision table. See Code In-P...C.B.R. : Comic Book Reader: CBR 0.6: 20 Issue trackers are closed and a lot of bugs too Localize view is now MVVM and delete is working. Added the unused flag (take care that it goes to true only when displaying screen elements) Backstage - new input/output format choice control for the conversion Backstage - Add display, behaviour and register file type options in the extended options dialog Explorer list view has been transformed to a custom control. New group header, colunms order and size are saved Single insta...Windows Azure Toolkit for Windows 8: Windows Azure Toolkit for Windows 8 Consumer Prv: Windows Azure Toolkit for Windows 8 Consumer Preview - Preview Release v1.2.1Minor updates to setup experience: Check for WebPI before install Dependency Check updated to support the following VS 11 and VS 2010 SKUs Ultimate, Premium, Professional and Express Certs Windows Azure Toolkit for Windows 8 Consumer Preview - Preview Release v1.2.0 Please download this for Windows Azure Toolkit for Windows 8 functionality on Windows 8 Consumer Preview. The core features of the toolkit include:...Facebook Graph Toolkit: Facebook Graph Toolkit 3.0: ships with JSON Toolkit v3.0, offering parse speed up to 10 times of last version supports Facebook's new auth dialog supports new extend access token endpoint new example Page Tab app filter Graph Api connections using dates fixed bugs in Page Tab appsScintillaNET: ScintillaNET 2.4: 3/12/2012 Jacob Slusser Added support for annotations. Issues Fixed with this Release Issue # Title 25012 25012 25018 25018 25023 25023 25014 25014 New ProjectsAlt Info Revised: Alt Info Revised is a modification for Heroes of Newerth which provides additional information and improved visuals.Android XML parser for .NET: A library for parsing Android binary XML format. You could use it to parse AndroidManifest.xml inside the APK files.C++ DSV Filter Library: The C++ DSV Filter Library is a simple to use, easy to integrate and extremely efficient and fast CSV/DSV in-memory data store processing library. The DSV filter allows for the efficient evaluation of complex expressions on a per row basis upon the loaded DSV store.CDSHOPMVC: CD Shop Project.Computation Visualizer: ???????????? ????????Create Hyper-V Server USB Memory: A simple application to automate the preparation process for booting Hyper-V Server 2008 R2. USB Flash Memory. csv viewer for large files: designed specifically for geonames.org file. this file lists all cities in the world excepts usa cities. this software allow reading in columns large file in a jtable. the other class generates a png with this coordinates latitude and longitude. a point is plot for each city.FIM CM Tools: FIM CM Tools are tools and samples written in C# for the Microsoft Forefront Identity Manager - Certificate Management Component. Based on FIMCM 2010. Currently it consists of: - Logging notification handlerFONIS telefonski imenik: FONIS telefonski imenik je program koji Vam omogucava da napravite i održavate telefonski imenik na Vašem racunaru. Program je razvijen u C#. Za instaliranje i pokretanje ovog programa, potrebno je instalirati .NET Framework 4.helmi: projet pfe helmi et moezHNQS: HNQSHow to Tie a Tie: A simple How to tie a tie appLiuyi.Phone.PhoneScreenSaver: PhoneScreenSaver Liuyi.Phone.PhoneScreenSaver windows phonemasterapp: Centraliza a informação de vários sites.POC using ASP.NET Web API: A Simple POC which uses : ASP.NET WebAPI AdventureWorksLT2008R2 Table AutoFac ( Dependancy Injection ) Restful Service JQuery Template Functionality : User search for a product Add/remove product to cart user can register himself for a new account Submit an orderRayBullet .Net Enterprise Application Libraries: RayBullet .Net Enterprise Application Libraries is a set of libraries for enterprise application development on Microsoft .Net framework platform. ReflectInsight Logging Extensions: ReflectInsight logging library extensions for 3rd party integration with Log4net, NLog, PostSharp, Enterprise Library and Visual Studio Trace. The ReflectInsight logging extentions make it easier to integrate you existing application logging infrastructure with the ReflectInsight viewer. You'll never need to look at your logging files in a text editor again and you'll have the full power of our viewer for searching, filtering and navigating your log files. The extensions are developed i...Responsive MVVM: MVVM is a great framework for Silverlight and WPF development. But the major flaw with MVVM is with its responsiveness. When the number of user controls increase beyond a certain limit, the UI gets very slow. Responsive MVVM framework aims to make the UI more responsive.road traffic modelling: Program simullates road traffic and managementSharePoint CAML Query Helper for 2007 and 2010: Use this program to help build and test SharePoint CAML Queries (Collaborative Application Markup Language). Compatible with WSS 3.0, MOSS 2007, Foundation 2010, and SharePoint 2010. Uses the SharePoint Object Model to connect to a site (using a URL). Gets all webs in a site, all lists in a web, and all fields/columns in a list. Can export field information to CSV. Also provides interface for building XML CAML Queries, with tools to make it easier managing field names (using drag-drop and cop...Speed up Printer migration using PrintBrm and it's configuration files: This tool is used to create the BrmConfig.XML file that can be used for quickly restoring all the print queues using the Generic / Text Only driver when migrating from a 32bit to a 64bit server.Ultimate Framework (Silverlight Navigation with Prism and Unity): Ultimate framework enables you to easily implement URL driven Silverlight LOB Application, leveraging Prism 4 and Unity for a Modular / Decoupled approach. Supporting nested and parallel frames navigation in Silverlight with any UserControl object within Silverlight.Windows 8 Metro WinRT Channel9 Viewer: Sample Metro App for viewing Channel 9 Videos.

    Read the article

  • How to check all check boxes at a click of a button

    - by LivingThing
    I am new to Swing, UI and MVC I have created a code based on MVC. Now my problem is that that in the controller part i have an actioneventlistener which listens to different button clicks. Out of all those buttons i have "select all" and "de-select all". In my view i have a table, one of the column of that table contains "check boxes". Now, when i click the "select-all" button i want to check all the check boxes and with "de-select all" i want to uncheck all of them. Below is my code which is not working. Please tell me what am i doing wrong here. Also, if someone knows a more elagent way please share. Thanks In my view public class CustomerSelectorDialogUI extends JFrame{ public CustomerSelectorDialogUI(TestApplicationUI ownerView, DummyCustomerStore dCStore, boolean modality) { //super(ownerView, modality); setTitle("[=] Customer Selection Dialog [=]"); //setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); custSelectPanel = new JPanel(); buttonPanel = new JPanel(); selectAllButton = new JButton(" Select All "); clearAllButton = new JButton(" Clear All "); applyButton = new JButton(" Apply "); cancelButton = new JButton(" Cancel "); PopulateAndShow(dCStore, Boolean.FALSE); } public void PopulateAndShow(DummyCustomerStore dCStore, Boolean select) { List data = new ArrayList(); for (Customer customer : dCStore.getAllCustomers()) { Object record[] = new Object[COLUMN_COUNT]; record[0] = (select == false) ? Boolean.FALSE : Boolean.TRUE; record[1] = Integer.toString(customer.customerId); record[2] = customer.fullName; data.add(record); } tModel = new TableModel(data); // In the above for loop accoring to user input (i.e click on check all or // uncheck all) i have tried to update the data. As it can be seen that i // have a condition for record[0]. //After the loop, here i have tried several options like validate(). repaint but to no avail customerTable = new JTable(tModel); scrollPane = new JScrollPane(customerTable); setContentPane(this.createContentPane()); setSize(480, 580); setResizable(false); setVisible(true); } private JPanel createContentPane() { custSelectPanel.setLayout(null); customerTable.setDragEnabled(false); customerTable.setFillsViewportHeight(true); scrollPane.setLocation(10, 10); scrollPane.setSize(450,450); custSelectPanel.add(scrollPane); buttonPanel.setLayout(null); buttonPanel.setLocation(10, 480); buttonPanel.setSize(450, 100); custSelectPanel.add(buttonPanel); selectAllButton.setLocation(0, 0); selectAllButton.setSize(100, 40); buttonPanel.add(selectAllButton); clearAllButton.setLocation(110, 0); clearAllButton.setSize(100, 40); buttonPanel.add(clearAllButton); applyButton.setLocation(240, 0); applyButton.setSize(100, 40); buttonPanel.add(applyButton); cancelButton.setLocation(350, 0); cancelButton.setSize(100, 40); buttonPanel.add(cancelButton); return custSelectPanel; } } Table Model private class TableModel extends AbstractTableModel { private List data; public TableModel(List data) { this.data = data; } private String[] columnNames = {"Selected ", "Customer Id ", "Customer Name " }; public int getColumnCount() { return COLUMN_COUNT; } public int getRowCount() { return data == null ? 0 : data.size(); } public String getColumnName(int col) { return columnNames[col]; } public void setValueAt(Object value, int rowIndex, int columnIndex) { getRecord(rowIndex)[columnIndex] = value; super.fireTableCellUpdated(rowIndex, columnIndex); } private Object[] getRecord(int rowIndex) { return (Object[]) data.get(rowIndex); } public Object getValueAt(int rowIndex, int columnIndex) { return getRecord(rowIndex)[columnIndex]; } public Class getColumnClass(int columnIndex) { if (data == null || data.size() == 0) { return Object.class; } Object o = getValueAt(0, columnIndex); return o == null ? Object.class : o.getClass(); } public boolean isCellEditable(int row, int col) { if (col > 0) { return false; } else { return true; } } } } A Views Action Listener class CustomerSelectorUIListener implements ActionListener{ CustomerSelectorDialogUI custSelectView; Controller controller; public CustomerSelectorUIListener (Controller controller, CustomerSelectorDialogUI custSelectView) { this.custSelectView = custSelectView; this.controller = controller; } @Override public void actionPerformed(ActionEvent e) { String actionEvent = e.getActionCommand(); else if ( actionEvent.equals( "clearAllButton" ) ) { controller.checkButtonControl(false); } else if ( actionEvent.equals( "selectAllButton" ) ) { controller.checkButtonControl(true); } } } Main Controller public class Controller implements ActionListener{ CustomerSelectorDialogUI selectUI; DummyCustomerStore store; public Controller( DummyCustomerStore store, TestApplicationUI appUI ) { this.store = store; this.appUI = appUI; appUI.ButtonListener( this ); } @Override public void actionPerformed(ActionEvent event) { String viewAction = event.getActionCommand(); if (viewAction.equals("TEST")) { selectUI = new CustomerSelectorDialogUI(appUI, store, true); selectUI.showTextActionListeners(new CustomerSelectorUIListener( this, selectUI ) ); selectUI.setVisible( true ); } } public void checkButtonControl (Boolean checkAll) { selectUI.PopulateAndShow(store, checkAll); } }

    Read the article

< Previous Page | 3 4 5 6 7