Search Results

Search found 37239 results on 1490 pages for 'javax swing text'.

Page 53/1490 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • Why is EventListenerList traversed backwards in fireFooXXX()?

    - by Joonas Pulakka
    I don't understand the rationale of this code, taken from javax.swing.event.EventListenerList docs: protected void fireFooXXX() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==FooListener.class) { // Lazily create the event: if (fooEvent == null) fooEvent = new FooEvent(this); ((FooListener)listeners[i+1]).fooXXX(fooEvent); } } } Why is the list traversed backwards? Why is only every second listener called? The event firing is implemented exactly this way in javax.swing.tree.DefaultTreeModel among others, so it's obviously me who's just not getting something.

    Read the article

  • How do I make a rectangle move in an image?

    - by alicedimarco
    Basically I have an image loaded, and when I click a portion of the image, a rectangle (with no fill) shows up. If I click another part of the image again, that rectangle will show up once more. With each click, the same rectangle should appear. So far I have this code, now I don't know how to make the image appear. My image from my file directory. I have already made the code to get the image from my file directory. import java.awt.Color; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class MP2 extends JPanel implements MouseListener{ JFrame frame; JPanel panel; int x = 0; int y = 0; String input; public MP2(){ } public static void main(String[] args){ JFrame frame = new JFrame(); MP2 panel = new MP2(); panel.addMouseListener(panel); frame.add(panel); frame.setSize(200,200); frame.setVisible(true); } public void mouseClicked(MouseEvent event) { // TODO Auto-generated method stub this.x = event.getX(); this.y = event.getY(); this.repaint(); input = JOptionPane.showInputDialog("Something pops out"); System.out.println(input); } public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } public void paintComponent(Graphics g){ super.paintComponent(g); // this.setBackground(Color.white); *Sets the bg color of the panel g.setColor(new Color(255,0,0)); g.drawRect(x, y, 100, 100); } }

    Read the article

  • JProgressBar.stringPainted(true); is not working

    - by Mirza Ghalib
    This is a part of my java code, in this code I have written that when I click the button the value of JProgressBar should becomes 0 and stringPainted(); becomes true, but "string painted" is not visible when I click the button, please help. import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JProgressBar; public class R implements ActionListener { static int y; CustomProgressBar b = new CustomProgressBar(); public static void main(String arg[]) throws Exception { new R(); } public R() throws Exception { JFrame f = new JFrame(); JButton btn = new JButton("Click"); f.setExtendedState(JFrame.MAXIMIZED_BOTH); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setUndecorated(true); f.setLayout(new FlowLayout()); btn.addActionListener(this); f.add(b); f.add(btn); f.setVisible(true); } class CustomProgressBar extends JProgressBar{ private static final long serialVersionUID = 1L; private boolean isStringToBePainted = false; public CustomProgressBar() { super(JProgressBar.VERTICAL,0,100); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(isStringToBePainted ) { Dimension size = CustomProgressBar.this.getSize(); if( CustomProgressBar.this.getPercentComplete()<0.9 ) R.y = (int)( size.height - size.height * CustomProgressBar.this.getPercentComplete() ); String text = getString(); g.setColor(Color.BLACK ); g.drawString(text, 0, R.y); } } @Override public void setStringPainted(boolean b) { isStringToBePainted=b; } } @Override public void actionPerformed(ActionEvent e) { b.setValue(0); b.setStringPainted(true); } }

    Read the article

  • How can I customize the title bar on JFrame?

    - by Jonas
    I would like to have a customized title bar in my Java Swing desktop application. What is the best way to do that? I can use a "Swing-title bar" by using the following code in the constructor for my JFrame: this.setUndecorated(true); this.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); But how do I customize it? Is there any UI delegates that I can override or do I have to implement my own title bar from scratch? I want something like Lawson Smart Office: Or like Trend Micro Internet Security:

    Read the article

  • What features do you expect from a Java (Rich) Client Framework?

    - by Peter Walser
    I'm intending to design (and provide a reference implementation for) a new Swing Rich Client Framework. My job and personal experience covers many project-specific Swing client frameworks as well as the Eclipse RCP, and every one of them had some original and clever concepts, but also drawbacks and rigid realizations. My plan is to incorporate the best of those concepts and features into a new framework whose core is very open and extendable. For my must-have-features list, I'm counting on your input and hope you can share some concept pearls & diamonds you've encountered in other frameworks, or features you always wanted to have or have in a better way. The framework is intended for very simple to very complex and sophisticated projects for clients that need full i18n for richt clients that execute some or all of the non-presentation logic on the server to be very lightweight to be easy to learn and use Thanks in advance for sharing your insights :)

    Read the article

  • how to use a wav file in eclipse

    - by AlphaAndOmega
    I've been trying to add audio to a project I've been doing. I found some code on here for html that is also supposed to work with file but it keeps saying "Exception in thread "main" javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source) at LoopSound.main(LoopSound.java:15)" the code public class LoopSound { public static void main(String[] args) throws Throwable { File file = new File("c:\\Users\\rabidbun\\Pictures\\10177-m-001.wav"); Clip clip = AudioSystem.getClip(); // getAudioInputStream() also accepts a File or InputStream AudioInputStream wav = AudioSystem.getAudioInputStream( file ); clip.open(wav); // loop continuously clip.loop(-1000); SwingUtilities.invokeLater(new Runnable() { public void run() { // A GUI element to prevent the Clip's daemon Thread // from terminating at the end of the main() JOptionPane.showMessageDialog(null, "Close to exit!"); } }); } } What is wrong with the code?

    Read the article

  • JAVA Menu Dimension

    - by ikurtz
    greetings. im am trying to learn JAVA/Swing, today is my first day. i have been able to set up a menu n my test application. but the item occupy very little space ie they are narrow. how do i go about extendng the amount of space it uses? screenshot can be view at the following URL: http://www.freeimagehosting.net/image.php?087aa4c9dc.jpg i am studying Teach Yourself Java 6 in 21 Days 5th Ed, Java Swing, 2nd Edition, 2002 and Teach Yourself Programming With Java In 24 Hours, 4th Edition (2005) bu none of them shed any light on this issue. thank you for your time.

    Read the article

  • Why Timer does not work if we do not generate a window?

    - by Roman
    Here is the code: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.Timer; public class TimerSample { public static void main(String args[]) { new JFrame().setVisible(true); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { System.out.println("Hello World Timer"); } }; Timer timer = new Timer(500, actionListener); timer.start(); } } It generates a window and then periodically prints "Hello World Timer" in the terminal (Command Prompt). If I comment this line new JFrame().setVisible(true); the application do not print anything to the command line. Why?

    Read the article

  • JTable.removeColumn() method throws exception

    - by sanjeev
    To hide a column from only the view of JTable, i am using the removeColumn() method. But it throws the exception Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 7 >= 7 at java.util.Vector.elementAt(Vector.java:470) at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:294) at javax.swing.plaf.basic.BasicTableHeaderUI.paint(BasicTableHeaderUI.java:648) i think, after removing column from the view, if i modified the model, then this exception pops out. is it because of there is no column in view, while the model is updating the table ? What is the best way to hide the column in view in JTable ? insteading of setting the sizes to 0.

    Read the article

  • MySQL Full-Text Search Across Multiple Tables - Quick/Long Solution?

    - by Kerry
    Hello all, I have been doing a bit of research on full-text searches as we realized a series of LIKE statements are terrible. My first find was MySQL full-text searches. I tried to implement this and it worked on one table, failed when I was trying to join multiple tables, and so I consulted stackoverflow's articles (look at the end for a list of the ones I've been to) I didn't see anything that clearly answered my questions. I'm trying to get this done literally in an hour or two (quick solution) but I also want to do a better long term solution. Here is my query: SELECT a.`product_id`, a.`name`, a.`slug`, a.`description`, b.`list_price`, b.`price`, c.`image`, c.`swatch`, e.`name` AS industry FROM `products` AS a LEFT JOIN `website_products` AS b ON (a.`product_id` = b.`product_id`) LEFT JOIN ( SELECT `product_id`, `image`, `swatch` FROM `product_images` WHERE `sequence` = 0) AS c ON (a.`product_id` = c.`product_id`) LEFT JOIN `brands` AS d ON (a.`brand_id` = d.`brand_id`) INNER JOIN `industries` AS e ON (a.`industry_id` = e.`industry_id`) WHERE b.`website_id` = 96 AND b.`status` = 1 AND b.`active` = 1 AND MATCH( a.`name`, a.`sku`, a.`description`, d.`name` ) AGAINST ( 'ashley sofa' ) GROUP BY a.`product_id` ORDER BY b.`sequence` LIMIT 0, 9 The error I get is: Incorrect arguments to MATCH If I remove d.name from the MATCH statement it works. I have a full-text index on that column. I saw one of the articles say to use an OR MATCH for this table, but won't that lose the effectiveness of being able to rank them together or match them properly? Other places said to use UNIONs but I don't know how to do that properly. Any advice would be greatly appreciated. In the idea of a long term solution it seems that either Sphinx or Lucene is best. Now by no means and I a MySQL guru, and I heard that Lucene is a bit more complicated to setup, any recommendations or directions would be great. Articles: http://stackoverflow.com/questions/1117005/mysql-full-text-search-across-multiple-tables http://stackoverflow.com/questions/668371/mysql-fulltext-search-across-1-table http://stackoverflow.com/questions/2378366/mysql-how-to-make-multiple-table-fulltext-search http://stackoverflow.com/questions/737275/pros-cons-of-full-text-search-engine-lucene-sphinx-postgresql-full-text-searc http://stackoverflow.com/questions/1059253/searching-across-multiple-tables-best-practices

    Read the article

  • How to display rich text in tooltip ASP.Net ?

    - by mokokamello
    Experts ! i use the following code to display a tooltip <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="AccessDataSource1"> <Columns> <asp:CommandField ShowEditButton="True" /> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /> <asp:BoundField DataField="datefu" HeaderText="date" SortExpression="datefu" /> <asp:TemplateField HeaderText="title" SortExpression="titlefu"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("titlefu") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <a href="#" title="<asp:Literal ID="Label1" runat="server" Text='<%# Eval("fu") %>'/>"/> <asp:Label ID="NamePatientLabel" runat="server" Text='<%# Eval("titlefu") %>' /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> display the following result however when i edit the text as follows (making it bold and red in another gridview containing rich text editor) i get the following (as a formatting result in the second grid view) however when i view in the first gridview to display the tooltip i get the following reult i really need your help to display the tooltip as rich text

    Read the article

  • SQL Server full text query across multiple tables - why so slow?

    - by Mikey Cee
    Hi. I'm trying to understand the performance of an SQL Server 2008 full-text query I am constructing. The following query, using a full-text index, returns the correct results immediately: SELECT O.ID, O.Name FROM dbo.EventOccurrence O WHERE FREETEXT(O.Name, 'query') ie, all EventOccurrences with the word 'query' in their name. And the following query, using a full-text index from a different table, also returns straight away: SELECT V.ID, V.Name FROM dbo.Venue V WHERE FREETEXT(V.Name, 'query') ie. all Venues with the word 'query' in their name. But if I try to join the tables and do both full-text queries at once, it 12 seconds to return: SELECT O.ID, O.Name FROM dbo.EventOccurrence O INNER JOIN dbo.Event E ON O.EventID = E.ID INNER JOIN dbo.Venue V ON E.VenueID = V.ID WHERE FREETEXT(E.Name, 'search') OR FREETEXT(V.Name, 'search') Here is the execution plan: http://uploadpad.com/files/query.PNG From my reading, I didn't think it was even possible to make a free text query across multiple tables in this way, so I'm not sure I am understanding this correctly. Note that if I remove the WHERE clause from this last query then it returns all results within a second, so it's definitely the full-text that is causing the issue here. Can someone explain (i) why this is so slow and (ii) if this is even supported / if I am even understanding this correctly. Thanks in advance for your help.

    Read the article

  • How do I get 3 lines of text from a paragraph

    - by Keltex
    I'm trying to create an "snippet" from a paragraph. I have a long paragraph of text with a word hilighted in the middle. I want to get the line containing the word before that line and the line after that line. I have the following piece of information: The text (in a string) The lines are deliminated by a NEWLINE character \n I have the index into the string of the text I want to hilight A couple other criteria: If my word falls on first line of the paragraph, it should show the 1st 3 lines If my word falls on the last line of the paragraph, it should show the last 3 lines Should show the entire paragraph in the degenative cases (the paragraph only has 1 or 2 lines) Here's an example: This is the 1st line of CAT text in the paragraph This is the 2nd line of BIRD text in the paragraph This is the 3rd line of MOUSE text in the paragraph This is the 4th line of DOG text in the paragraph This is the 5th line of RABBIT text in the paragraph Example, if my index points to BIRD, it should show lines 1, 2, & 3 as one complete string like this: This is the 1st line of CAT text in the paragraph This is the 2nd line of BIRD text in the paragraph This is the 3rd line of MOUSE text in the paragraph If my index points to DOG, it should show lines 3, 4, & 5 as one complete string like this: This is the 3rd line of MOUSE text in the paragraph This is the 4th line of DOG text in the paragraph This is the 5th line of RABBIT text in the paragraph etc. Anybody want to help tackle this?

    Read the article

  • How do I get 3 lines of text from a paragraph in C#

    - by Keltex
    I'm trying to create an "snippet" from a paragraph. I have a long paragraph of text with a word hilighted in the middle. I want to get the line containing the word before that line and the line after that line. I have the following piece of information: The text (in a string) The lines are deliminated by a NEWLINE character \n I have the index into the string of the text I want to hilight A couple other criteria: If my word falls on first line of the paragraph, it should show the 1st 3 lines If my word falls on the last line of the paragraph, it should show the last 3 lines Should show the entire paragraph in the degenative cases (the paragraph only has 1 or 2 lines) Here's an example: This is the 1st line of CAT text in the paragraph This is the 2nd line of BIRD text in the paragraph This is the 3rd line of MOUSE text in the paragraph This is the 4th line of DOG text in the paragraph This is the 5th line of RABBIT text in the paragraph Example, if my index points to BIRD, it should show lines 1, 2, & 3 as one complete string like this: This is the 1st line of CAT text in the paragraph This is the 2nd line of BIRD text in the paragraph This is the 3rd line of MOUSE text in the paragraph If my index points to DOG, it should show lines 3, 4, & 5 as one complete string like this: This is the 3rd line of MOUSE text in the paragraph This is the 4th line of DOG text in the paragraph This is the 5th line of RABBIT text in the paragraph etc. Anybody want to help tackle this?

    Read the article

  • Entangled text boxes

    - by user38329
    Hi StackOverflow, A mere Windows textbox greatly surprised me today. I have two unrelated text boxes inside an application. I can type in either text box and switch the focus by clicking on them. Then happens some event X, which I can't describe here for reasons given below. After this event happens, the two text boxes become "entangled" in an almost quantum way. Say, text box A was focused before X happened. When I click text box B to type in some text, the new text appears in text box A, whereas the blinking cursor happily moves along in text box B through the void, as if the text were there. No amount of clicking on either text boxes can resolve this. The cursor will always remain in B, whereas the text will always go to A. Message spying reveals that after the event X, the text boxes lose the ability to lose or gain focus. When I click on B, WM_LOSE_FOCUS does not come to A, and WM_SET_FOCUS does not come to B. (The rectangles and visibility of the boxes are OK.) The same thing happens in Windows XP and Windows 7. Now, event X: it's a big event in a third-party UI library which I cannot reverse-engineer in a timely manner. (Namely, docking a pane in wxAUI.) I am sure that this behavior is the result of incorrect WinAPI calls to the text boxes (garbage in - garbage out). I would like to know what could possibly cause such "textbox trip" to know where to start looking for the bug. Thanks!

    Read the article

  • Saving a compressed text attachment results in empty file

    - by Brandon
    I have a text document with compressed text in it, the text is auto generated by a program. The text document is fine on my machine (Vista 32-bit), and can be used normally. The other person can also create and use these files just fine. (XP 32-bit) However when I email it to someone else (Outlook 2003 on both machines) the attachment is sent fine (5kb) but when the other person tries to save it somewhere, the saved file is empty. (64b) At first I thought Outlook didn't like compressed text files (security risk maybe?), but I can receive the text files just fine. Is there a setting somewhere on the other persons machine that tells Outlook not to trust compressed text? Can anyone think of a reason why these files are being saved as empty text documents?

    Read the article

  • Performance Enhancement in Full-Text Search Query

    - by Calvin Sun
    Ever since its first release, we are continuing consolidating and developing InnoDB Full-Text Search feature. There is one recent improvement that worth blogging about. It is an effort with MySQL Optimizer team that simplifies some common queries’ Query Plans and dramatically shorted the query time. I will describe the issue, our solution and the end result by some performance numbers to demonstrate our efforts in continuing enhancement the Full-Text Search capability. The Issue: As we had discussed in previous Blogs, InnoDB implements Full-Text index as reversed auxiliary tables. The query once parsed will be reinterpreted into several queries into related auxiliary tables and then results are merged and consolidated to come up with the final result. So at the end of the query, we’ll have all matching records on hand, sorted by their ranking or by their Doc IDs. Unfortunately, MySQL’s optimizer and query processing had been initially designed for MyISAM Full-Text index, and sometimes did not fully utilize the complete result package from InnoDB. Here are a couple examples: Case 1: Query result ordered by Rank with only top N results: mysql> SELECT FTS_DOC_ID, MATCH (title, body) AGAINST ('database') AS SCORE FROM articles ORDER BY score DESC LIMIT 1; In this query, user tries to retrieve a single record with highest ranking. It should have a quick answer once we have all the matching documents on hand, especially if there are ranked. However, before this change, MySQL would almost retrieve rankings for almost every row in the table, sort them and them come with the top rank result. This whole retrieve and sort is quite unnecessary given the InnoDB already have the answer. In a real life case, user could have millions of rows, so in the old scheme, it would retrieve millions of rows' ranking and sort them, even if our FTS already found there are two 3 matched rows. Apparently, the million ranking retrieve is done in vain. In above case, it should just ask for 3 matched rows' ranking, all other rows' ranking are 0. If it want the top ranking, then it can just get the first record from our already sorted result. Case 2: Select Count(*) on matching records: mysql> SELECT COUNT(*) FROM articles WHERE MATCH (title,body) AGAINST ('database' IN NATURAL LANGUAGE MODE); In this case, InnoDB search can find matching rows quickly and will have all matching rows. However, before our change, in the old scheme, every row in the table was requested by MySQL one by one, just to check whether its ranking is larger than 0, and later comes up a count. In fact, there is no need for MySQL to fetch all rows, instead InnoDB already had all the matching records. The only thing need is to call an InnoDB API to retrieve the count The difference can be huge. Following query output shows how big the difference can be: mysql> select count(*) from searchindex_inno where match(si_title, si_text) against ('people')  +----------+ | count(*) | +----------+ | 666877 | +----------+ 1 row in set (16 min 17.37 sec) So the query took almost 16 minutes. Let’s see how long the InnoDB can come up the result. In InnoDB, you can obtain extra diagnostic printout by turning on “innodb_ft_enable_diag_print”, this will print out extra query info: Error log: keynr=2, 'people' NL search Total docs: 10954826 Total words: 0 UNION: Searching: 'people' Processing time: 2 secs: row(s) 666877: error: 10 ft_init() ft_init_ext() keynr=2, 'people' NL search Total docs: 10954826 Total words: 0 UNION: Searching: 'people' Processing time: 3 secs: row(s) 666877: error: 10 Output shows it only took InnoDB only 3 seconds to get the result, while the whole query took 16 minutes to finish. So large amount of time has been wasted on the un-needed row fetching. The Solution: The solution is obvious. MySQL can skip some of its steps, optimize its plan and obtain useful information directly from InnoDB. Some of savings from doing this include: 1) Avoid redundant sorting. Since InnoDB already sorted the result according to ranking. MySQL Query Processing layer does not need to sort to get top matching results. 2) Avoid row by row fetching to get the matching count. InnoDB provides all the matching records. All those not in the result list should all have ranking of 0, and no need to be retrieved. And InnoDB has a count of total matching records on hand. No need to recount. 3) Covered index scan. InnoDB results always contains the matching records' Document ID and their ranking. So if only the Document ID and ranking is needed, there is no need to go to user table to fetch the record itself. 4) Narrow the search result early, reduce the user table access. If the user wants to get top N matching records, we do not need to fetch all matching records from user table. We should be able to first select TOP N matching DOC IDs, and then only fetch corresponding records with these Doc IDs. Performance Results and comparison with MyISAM The result by this change is very obvious. I includes six testing result performed by Alexander Rubin just to demonstrate how fast the InnoDB query now becomes when comparing MyISAM Full-Text Search. These tests are base on the English Wikipedia data of 5.4 Million rows and approximately 16G table. The test was performed on a machine with 1 CPU Dual Core, SSD drive, 8G of RAM and InnoDB_buffer_pool is set to 8 GB. Table 1: SELECT with LIMIT CLAUSE mysql> SELECT si_title, match(si_title, si_text) against('family') as rel FROM si WHERE match(si_title, si_text) against('family') ORDER BY rel desc LIMIT 10; InnoDB MyISAM Times Faster Time for the query 1.63 sec 3 min 26.31 sec 127 You can see for this particular query (retrieve top 10 records), InnoDB Full-Text Search is now approximately 127 times faster than MyISAM. Table 2: SELECT COUNT QUERY mysql>select count(*) from si where match(si_title, si_text) against('family‘); +----------+ | count(*) | +----------+ | 293955 | +----------+ InnoDB MyISAM Times Faster Time for the query 1.35 sec 28 min 59.59 sec 1289 In this particular case, where there are 293k matching results, InnoDB took only 1.35 second to get all of them, while take MyISAM almost half an hour, that is about 1289 times faster!. Table 3: SELECT ID with ORDER BY and LIMIT CLAUSE for selected terms mysql> SELECT <ID>, match(si_title, si_text) against(<TERM>) as rel FROM si_<TB> WHERE match(si_title, si_text) against (<TERM>) ORDER BY rel desc LIMIT 10; Term InnoDB (time to execute) MyISAM(time to execute) Times Faster family 0.5 sec 5.05 sec 10.1 family film 0.95 sec 25.39 sec 26.7 Pizza restaurant orange county California 0.93 sec 32.03 sec 34.4 President united states of America 2.5 sec 36.98 sec 14.8 Table 4: SELECT title and text with ORDER BY and LIMIT CLAUSE for selected terms mysql> SELECT <ID>, si_title, si_text, ... as rel FROM si_<TB> WHERE match(si_title, si_text) against (<TERM>) ORDER BY rel desc LIMIT 10; Term InnoDB (time to execute) MyISAM(time to execute) Times Faster family 0.61 sec 41.65 sec 68.3 family film 1.15 sec 47.17 sec 41.0 Pizza restaurant orange county california 1.03 sec 48.2 sec 46.8 President united states of america 2.49 sec 44.61 sec 17.9 Table 5: SELECT ID with ORDER BY and LIMIT CLAUSE for selected terms mysql> SELECT <ID>, match(si_title, si_text) against(<TERM>) as rel  FROM si_<TB> WHERE match(si_title, si_text) against (<TERM>) ORDER BY rel desc LIMIT 10; Term InnoDB (time to execute) MyISAM(time to execute) Times Faster family 0.5 sec 5.05 sec 10.1 family film 0.95 sec 25.39 sec 26.7 Pizza restaurant orange county califormia 0.93 sec 32.03 sec 34.4 President united states of america 2.5 sec 36.98 sec 14.8 Table 6: SELECT COUNT(*) mysql> SELECT count(*) FROM si_<TB> WHERE match(si_title, si_text) against (<TERM>) LIMIT 10; Term InnoDB (time to execute) MyISAM(time to execute) Times Faster family 0.47 sec 82 sec 174.5 family film 0.83 sec 131 sec 157.8 Pizza restaurant orange county califormia 0.74 sec 106 sec 143.2 President united states of america 1.96 sec 220 sec 112.2  Again, table 3 to table 6 all showing InnoDB consistently outperform MyISAM in these queries by a large margin. It becomes obvious the InnoDB has great advantage over MyISAM in handling large data search. Summary: These results demonstrate the great performance we could achieve by making MySQL optimizer and InnoDB Full-Text Search more tightly coupled. I think there are still many cases that InnoDB’s result info have not been fully taken advantage of, which means we still have great room to improve. And we will continuously explore the area, and get more dramatic results for InnoDB full-text searches. Jimmy Yang, September 29, 2012

    Read the article

  • How to right-justify icon in a JLabel?

    - by geoffreyzheng
    For a JLabel with icon, if you setHorizontalTextPosition(SwingConstants.LEADING), the icon is painted right after text, no matter how wide the label is. This is particularly bad for a list, as the icons would be all over the place depending on how long the text is for each item. I traced the code and it seems to be that in SwingUtilities#layoutCompoundLabelImpl, text width is simply set to SwingUtilities2.stringWidth(c, fm, text), and icon x is set to follow text without considering label width. Here is the simplest case: import java.awt.*; import javax.swing.*; public class TestJLabelIcon { public static void main(String args[]) { EventQueue.invokeLater(new Runnable() { public void run() { JLabel c = new JLabel("abc"); c.setHorizontalTextPosition(SwingConstants.LEADING); c.setHorizontalAlignment(SwingConstants.LEADING); c.setIcon(UIManager.getIcon("FileChooser.detailsViewIcon")); c.setBorder(BorderFactory.createLineBorder(Color.RED)); JFrame frame = new JFrame(); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.getContentPane().add(c); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } } You can see that label always fills the frame but icon stays put. You'll get the mirror problem if you set both arguments to TRAILING. I know I can override the UI, or use a JPanel, etc. I just wonder if I'm missing something simple in JLabel. If not, it seems like a Java bug. FYI this is jdk1.6.0_06 on Windows XP.

    Read the article

  • Swing Grid Layout or JTable

    - by ikurtz
    greetngs, i am trying to learn Java and Swing by writing a simple game of connect4. i am hoping you could guide me regarding the following issue: to emulate the connect4 grid should i use a JTable or rely on Grid layout? thank you.

    Read the article

  • Default program for opening .pro Qt project files

    - by air-dex
    I would like to set Qt Creator (the one which is in the Nokia Qt SDK, not the one in Canonical PPAs) as the default program to open .pro Qt project files. But it appears that my Ubuntu install (12.04 while I am writing the question) recognizes .pro files as plain text files instead of Qt project files. I know that I could fix the problem by setting Qt Creator as the default program for opening plain text files but I want to keep on opening plain text files with the program I currently use for this (gedit). So my question is : how can I do for making my Ubuntu install recognizing .pro files as Qt project files instead of plain text files ? NB : I have already looked at Ubuntu Tweak to associate Qt project files with Qt Creator but I did not find anything relevant (perhaps I missed it too). EDIT : the solution is in the last comment of the accepted answer.

    Read the article

  • how to get the application listed on open with menu?

    - by user17182377182122092121021929
    I have installed the sublime text 2 in sublime text by http://www.technoreply.com/how-to-install-sublime-text-2-on-ubuntu-12-04-unity/ way. now I can see them on when I click Win button and search for it. Same time I want to see them in open with context. I means when I right click on file and choose. open with other application how I can choose the sublime text. I can't see the option their to do this. Thanks for help in advance.

    Read the article

  • JPanel: both implementing my own paintComponent() and rendering children doesn't work

    - by Paul Marshall
    I'm extending a JPanel to display a game board, and adding a JEditorPane at the bottom to hold some status text. Unfortunately, the game board renders just fine, but the JEditorPane is just a blank gray area until I highlight the text in it, when it will render whatever text is highlighted (but not the rest). If I'm understanding Swing right, it should work, because super.paintComponent(g) should render the other children (i.e., the JEditorPane). Tell me, o great stackoverflow, what bonehead mistake am I making? public GameMap extends JPanel { public GameMap() { JEditorPane statusLines = new JEditorPane("text/plain","Stuff"); this.setLayout(new BoxLayout(this,BoxLayout.PAGE_AXIS)); this.add(new Box.Filler(/*enough room to draw my game board*/)); this.add(statusLines); } public void paintComponent(Graphics g){ super.paintComponent(g); for ( all rows ){ for (all columns){ //paint one tile } } } }

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >