Social Icons

Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Monday, July 22, 2013

JTattoo : Brings a whole new Look and Feel to your J2 applications


Are you fed up with the look and feel of your J2 applications? Well, You are not alone. Originally JDK is shipped with only 03 Look and Feel classes to present UI components in our Java applications (Nimbus,Metal and Motif) or you can use the default system UI by invoking UIManager.getSystemLookAndFeelClassName()).

Which brings us to JTattoo , It is Java library of LookAndFeel classes ,and provides us with 13 different look and feel classes to choose from . Users have different life styles and preferences, While some can get along with simple and lightweight themes , some may prefer darker and flashy UIs. By using JTattoo's wide range of options we can let user decide how he wants our J2 applications to look like according to their tastes.

Here are some sample look and feel classes. you can view all available LF classes here.

                    

                   

How to change LookAndFeel Class?
Following code shows how to assign LF classes dynamically. I have chosen 'smart' LF in JTatoo library.

 public void changeLF() {
        try {
            // select Look and Feel for e:g "Smart" LF
            UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");
            //initialize this frame's UI Trees with the current look and feel.
            SwingUtilities.updateComponentTreeUI(this);            
        }
        catch (Exception ex) {
            //catches UnsupportedLookAndFeelException & ClassNotFoundException
            ex.printStackTrace();
        }
 } // end 

All available LF classes.
  • com.jtattoo.plaf.aero.AeroLookAndFeel
  • com.jtattoo.plaf.acryl.AcrylLookAndFeel
  • com.jtattoo.plaf.fast.FastLookAndFeel
  • com.jtattoo.plaf.mcwin.McWinLookAndFeel
  • com.jtattoo.plaf.mint.MintLookAndFeel
  • com.jtattoo.plaf.smart.SmartLookAndFeel
  • com.jtattoo.plaf.aluminium.AluminiumLookAndFeel
  • com.jtattoo.plaf.bernstein.BernsteinLookAndFeel
  • com.jtattoo.plaf.graphite.GraphiteLookAndFee
  • com.jtattoo.plaf.hifi.HiFiLookAndFeel
  • com.jtattoo.plaf.noire.NoireLookAndFeel"
  • com.jtattoo.plaf.texture.TextureLookAndFeel"

Sunday, June 23, 2013

JStockCharts Update: Combined series chart has been added to Comparable Counters.




Your user friendly charting application has just been updated with a new chart type, It's not an Indicator type but an extremely useful type to render. This chart type is just for the Counter comparison tool and only available therein. Users can select different counters ,select the chart type ( Line(Combined)) for a specific period and press draw button, actually you don't need to select the orientation options for the frame has only one pre configured layout.  
                    Once rendered users are able to view WAP price movements of selected shares for the given period in one plot. Now this is immensely come in handy when you want to compare counters in the same sector , for an example , in the above screenshot I have selected 03 popular banking shares to compare. As always suggestions are welcome to improve this chart type and also make Counter comparison tool more efficient.




___________________________________________________________________
Official Site

Direct download

WAP File mailing-list(Please subscribe to receive daily WAP File)
___________________________________________________________________

Sunday, June 9, 2013

JStockChart: Update Notification - Parabolic SAR Indicator


Developed by Welles Wilder, the Parabolic SAR refers to a price-and-time-based trading system. Wilder called this the "Parabolic Time/Price System." SAR stands for "stop and reverse," which is the actual indicator used in the system. SAR trails price as the trend extends over time.The indicator is below prices when prices are rising and above prices when prices are falling. In this regard, the indicator stops and reverses when the price trend reverses and breaks above or below the indicator.


___________________________________________________________________
Official Site

Direct download

WAP File mailing-list(Please subscribe to receive daily WAP File)
___________________________________________________________________

Sunday, May 26, 2013

JStockCharts Update : Stock Charts Comparison Tool & Mass Index Indicator


Stock Charts Comparison Tool


Comparison Tool  rendered on a 19" widescreen monitor
Stocks (Counters) Comparison tool is the latest addition to JStockCharts and of which I'm really proud of presenting to my users. The knowledge/experience I gained coding this tool is enormous and Even I'm genuinely thrilled to write this blogpost about it.
             Essentially , using this tool users can select up to 06 shares , select a specific chart type/indicator , select a specific period and draw charts for them separately as depicted in the screenshot, this shall be usefull when it comes to observe sector wise trends and I intend to improvise this tool more by letting users to save selections in persistent state so that they can be observed time to time, as is the case of ever changing stock market.
               Actually there is no theoretical limitation to the number of shares that can be compared, but I have put up this limitation of 06 counters to render charts more clearly on single monitor systems, I'm afraid most people use notebook computers hence even 06 charts wouldn't be clearly analyzable. Feel free to try this an new ideas and suggestions are always welcome and would be highly appreciated.

New Indicator : Mass Index



Developed by Donald Dorsey, the Mass Index uses the high-low range to identify trend reversals based on range expansions. In this sense, the Mass Index is a volatility indicator that does not have a directional bias. Instead, the Mass Index identifies range bulges that can foreshadow a reversal of the current trend.


___________________________________________________________________
Official Site

Direct download

WAP File mailing-list(Please subscribe to receive daily WAP File)
___________________________________________________________________



Saturday, May 25, 2013

JD-GUI , A lightweight java decompiler




JD-GUI is a standalone graphical utility that displays Java source codes of “.class” or ".jar" files . You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields. This is a free tool for non-commercial use. I can guarantee you it's fast and reliable tool. I have been using it for couple weeks now and I'm totally contented with it.
JD-GUI is free for non-commercial use. This means that JD-GUI shall not be included or embedded into commercial software products. Nevertheless, this project may be freely used for personal needs in a commercial or non-commercial environments.


JD-GUI is can be downloaded by visiting it's official site and is available for Windows, Linux and Mac platforms. 

Main Features

  • JD-Core and JD-GUI are written in C++. This allows an extremely fast decompilation and a display.
  • JD-Core does not require the Java runtime environment for its functioning, therefore no special setup is required.
  • JD-Core works with most current compilers including the following:
    • jdk1.1.8
    • jdk1.3.1
    • jdk1.4.2
    • jdk1.5.0
    • jdk1.6.0
    • jdk1.7.0
    • jikes-1.22
    • harmony-jdk-r533500
    • Eclipse Java Compiler v_677_R32x, 3.2.1 release
    • jrockit90_150_06
  • JD-Core supports the following new features of Java 5:
    • Annotations
    • Generics
    • Type “enum”
  • JD-GUI supports Drag and Drop.
  • JD-GUI supports JAR files.
  • JD-GUI displays color coded Java source code.
  • JD-GUI allows you to browse the “class” files hierarchy.
  • JD-GUI displays “log” files, and allow you to decompile “class” files appearing in Java stack traces.
  • JD-Core, JD-GUI and JD-Eclipse use the excellent cross-platform wxWidgets toolkit.








Sunday, May 5, 2013

JStockCharts update- Aroon Indicator & StochRSI Charts


Aroon Indicator
Developed by Tushar Chande in 1995, Aroon is an indicator system that determines whether a stock is trending or not and how strong the trend is. "Aroon" means "Dawn's Early Light" in Sanskrit. Chande chose this name because the indicators are designed to reveal the beginning of a new trend. The Aroon indicators measure the number of periods since price recorded an x-day high or low.


StochRSI
Developed by Tushard Chande and Stanley Kroll, StochRSI is an oscillator that measures the level of RSI relative to its high-low range over a set time period. StochRSI applies the Stochastics formula to RSI values, instead of price values. This makes it an indicator of an indicator. The result is an oscillator that fluctuates between 0 and 1.



___________________________________________________________________
Official Site

Direct download

WAP File mailing-list(Please subscribe to receive daily WAP File)
____________________________________________________________________________


Sunday, April 28, 2013

JStockCharts update- WatchList & Percentage Price Oscillator Chart


If you are new to JStockCharts please refer to this post.

I have been working on a way to enable users to save his favorite/holding shares and daily monitor their trading summary through a single window. The Latest feature of the JStockCharts , WatchList enables users to accomplish this task. It simply provides a window to add/remove your desired shares to the table on the right side, once you updated the latest price list to the application you can go ahead and analyze the trading summary of the shares in your watchList easily by clicking the ico_alpha_ClipboardEdit_24x24 icon in the toolbar or by going through Tools menu.

wl

Technical Indicator – PPO ( Percentage Price Oscillator)
The Percentage Price Oscillator (PPO) is a momentum oscillator that measures the difference between two moving averages as a percentage of the larger moving average. As with its cousin, MACD, the Percentage Price Oscillator is shown with a signal line, a histogram and a centerline. Signals are generated with signal line crossovers, centerline crossovers and divergences. Because these signals are no different than those associated with MACD, this article will focus on a few differences between the two. First, PPO readings are not subject to the price level of the security. Second, PPO readings for different securities can be compared, even when there are large differences in the price.
Reference : StockCharts.com
This useful indicator charts are available for over 03 Months periods.

ppo

___________________________________________________________________
Official Site
http://wkhhost.hostoi.com/JChartsWeb/index.html

Direct download
https://sourceforge.net/projects/jchartscse/files/latest/download

WAP File mailing-list(Please subscribe to receive daily WAP File)
https://lists.sourceforge.net/lists/listinfo/jchartscse-wapfeed
____________________________________________________________________________

Monday, April 8, 2013

Introducing JStockCharts - Technical Analysis tool for Equity trading in Colombo Stock Exchange (CSE)



JStockCharts is a java based charting application with added features such signal generator and historical price viewer, chart comparison tool. Supports all widely used technical indicators. The system uses a local database to which a price list (WAP File) shall be uploaded daily. The file can be obtained by subscribing to the wap feed mailing-list.




Available chart types
Following chart types are available if you select over 03 months time period. This list grows frequently so make sure to subscribe to my blog to receive updates about new additions to the application and chart types.




Sample Charts
Price & Turnover

Relative Strength Index

Ease of Movement
       

Candlestick Chart


Technical indicator value generator

Using this tool users can query for counters which meet certain criteria such as , this list keeps getting longer with weekly updates. (subscribe to the official mailing-list to receive update notifications)

  • MACD crossing the signal line from below , from above etc
  • RSI overbought/oversold counters
  • SMA - Cross from below/above
  • CCI - overbought/oversold 
  • Volatility
  • Momentum
  • New 52Week High/Low




Historical Prices

This tool enables users to

  • View OHLC , Turnover and Volume data for a specific counter for a specific date or for  a date range and all counters for a specific date or date range. 
  • View High Low prices for all counters or a selected counter (Highs & Lows) ,
  • View if a selected counter recorded a given gain percentage over a specific time period. (Gain Analyzer)


Counter Comparison Tool

This too enables users to compare various shares in a single window. select shares , select a chart type , select a grid type and you are provided with multiple charts withing the same container. Also users are able to draw line charts of different counters in the same plot (Line (Combined)).


Line (Combined) Chart type
_________________________________________________________________
Official Site
http://wkhhost.hostoi.com/JChartsWeb/index.html

Direct download
https://sourceforge.net/projects/jchartscse/files/latest/download

WAP File mailing-list(Please subscribe to receive daily WAP File)
https://lists.sourceforge.net/lists/listinfo/jchartscse-wapfeed
_________________________________________________________________

System Requirements:
*. Java Run-time version 7 or above (Download)
*. Supported Operating Systems : Windows XP or above, Linux , MAC OS X, Solrais

Installation
No installation is required , you can use this as a portable application.

1. Download JStockCharts.rar by visiting the above direct download link.
2. Extract the downloaded file in to a desired location (e.g C:\)
3. Add shortcut to the JStockCharts.exe file to the desktop.
4. Run the application using the above shortcut.

Enjoy!!

Google+ 

Monday, December 24, 2012

Comma separation code in Java




Displaying large figures without comma separation is quite daunting to the users. For an example just think how hard to discern the value of 9501625237.56 ? Instead of displaying such number as it is we can format the said value using commas which would be more readable , like this  9,501,625,237.56 If displayed likewise An user wouldn't have to waste time deciphering such lengthy values. Here is the code I wrote to accomplish this output using Java to utilize into much larger programs. The method can be overridden or overloaded as you would deem necessary. 

Input : Takes the value to be formatted as a  String object.
Returns: Formatted value as a String object.
private String addCommas(String strn){

         String commaSeparatedNumber="", decimals="";
        //split contents before the decimal point

        commaSeparatedNumber = strn.contains(".") ?   strn.split("\\.")[0] : strn;
        decimals = strn.contains(".") ? "."+strn.split("\\.")[1] : "";

        /*create a regular expression for the thousand separator, store those matches separately for the replacement.*/
        String regx="(\\d+)(\\d{3})";

        //create pattern and matcher objects to find matches
        Pattern p = Pattern.compile(regx);
        Matcher m = p.matcher(commaSeparatedNumber);

        //iterate to find the next match.
        while(m.find()){
            //replace the found matching groups with the comma.
            commaSeparatedNumber = commaSeparatedNumber.replaceFirst(regx, m.group(1) +","+ m.group(2));
            //update the matcher with new replacements.
            m = p.matcher(commaSeparatedNumber);
        }

        return commaSeparatedNumber+decimals;
    }


Saturday, June 26, 2010

Java 4-ever : Trailer for Javazone


JavaZone is Scandinavia's biggest meeting place for software developers, and one of Europe's most important. JavaZone has been described as a high-quality, independent conference, and is a forum for knowledge exchange,
The 2010 Program, which will be held in Oslo, Norway from September 8 to 9 and estimates over 2,000 attendees, is the ninth consecutive meeting since non-profit organizer javaBin was established in 1996.

JavaZone released the full teaser for the mock film Java 4-ever, about a young man who can no longer hide his suppressed love for Java from his orthodox .NET-loving family. Cue dramatic trailer tropes (the good ol’ father-dropping-to-knees-in-utter-shock-upon-discovering-son’s-secret always gets me), heart-rending music that never fails, and intense Norwegian thespians, and I’m sold.

Friday, June 4, 2010

How to get HTML hex color number – java


Following code shows how to get the HTML color code in Hexadecimal base in your java code which then can be used in a HTML code . java.awt.Color object must be passes as the argument.

/**
* Get #ffffff html hex number for a colour
*
* @see #toHexString(int)
* @param c
*        Color object whose html colour number you want as a string
* @return # followed by exactly 6 hex digits
*/
public final static String toString ( Color c ){
   String s = Integer.toHexString( c.getRGB() & 0xffffff );
   if ( s.length() < 6 )
      { // pad on left with zeros
      s = "000000".substring( 0, 6 - s.length() ) + s;
      }
   return '#' + s;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Saturday, May 15, 2010

XStream - java library to serialize objects to XML



 

XStream is a simple library to serialize objects to XML and back again. (Tutorial)


Feautres
  • Ease of use. A high level facade is supplied that simplifies common use cases.
  • No mappings required. Most objects can be serialized without need for specifying mappings.
  • Performance. Speed and low memory footprint are a crucial part of the design, making it suitable for large object graphs or systems with high message throughput.
  • Clean XML. No information is duplicated that can be obtained via reflection. This results in XML that is easier to read for humans and more compact than native Java serialization.
  • Requires no modifications to objects. Serializes internal fields, including private and final. Supports non-public and inner classes. Classes are not required to have default constructor.
  • Full object graph support. Duplicate references encountered in the object-model will be maintained. Supports circular references.
  • Integrates with other XML APIs. By implementing an interface, XStream can serialize directly to/from any tree structure (not just XML).
  • Customizable conversion strategies. Strategies can be registered allowing customization of how particular types are represented as XML.
  • Error messages. When an exception occurs due to malformed XML, detailed diagnostics are provided to help isolate and fix the problem.
  • Alternative output format. The modular design allows other output formats. XStream ships currently with JSON support and morphing.
Download | Tutorial 

Thursday, May 13, 2010

How to create a tabbed window – Swing


This basic tutorial demonstrates how to create tabs in a java GUI window . Let’s assume that we are going to create a Crypto tool, which can encrypt some data and also decrypt  some encrypted data into some readable format. But of course I have no intention to discuss how to encrypt/decrypt data here. For the user friendliness of our GUI it is better to separately display these two tasks in it. hence we will have a Encryption tab and a decryption tab and so on.

This is the preview of the tabbed window. I added only a single button to keep the code short and concise.

Untitled

The GUI has just two tabs. every tab has a title , an icon (optional) and a component ( the component to be displayed when the tab is clicked). this component is most probably a JPanel which contains all the other components (buttons , labels …etc). and optionally , a tooltip can also be added . the source code for  creating tabbed window is given below.

package hasijournal.tabbeddemo;
import javax.swing.*;
import java.awt.*;
class Crypto extends JFrame {
    public Crypto() {
        setTitle("Crypto Tool");
        JTabbedPane jtp = new JTabbedPane();
        // get the container
        getContentPane().add(jtp);
        // create tab components
        JPanel jp1 = new JPanel();
        JPanel jp2 = new JPanel();
        jp1.setLayout(new BorderLayout());
        jp2.setLayout(new BorderLayout());
        
        JButton ebtn = new JButton("Encrypt data");
        jp1.add(ebtn, BorderLayout.SOUTH);
        JButton dbtn = new JButton("Decrypt data");
        jp2.add(dbtn, BorderLayout.SOUTH);
        
        // add icons
        Icon it1= new ImageIcon("enc.png");
        Icon it2= new ImageIcon("dec.png");
        
        /*--- Overloaded addTab methods in JTabbePane class---*/
        //  void addTab(String title, Component component)
        /*  Adds a component represented by a title and no icon. */
        // void addTab(String title, Icon icon, Component component)          
        /* Adds a component represented by a title and/or icon,*/
        
        // void addTab(String title, Icon icon, Component component, String tip)
        /* Adds a component and tip represented by a title and/or icon */
        jtp.addTab("Encrypt",it1,jp1,"Encrypts data");
        jtp.addTab("Decrypt",it2,jp2,"Decrypts data");
        
        
    }
    public static void main(String[] args)  {
        Crypto tp = new Crypto();
        tp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        tp.setBounds(100,100, 300, 300);
        try{
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }catch(Exception e){}
        SwingUtilities.updateComponentTreeUI(tp);
        
        tp.setVisible(true);
    }
}


 

Wednesday, May 12, 2010

maxBlock : solutions for Javabat :18



Given a string, return the length of the largest "block" in the string. A block is a run of adjacent chars that are the same.

maxBlock("hoopla") → 2
maxBlock("abbCCCddBBBxx") → 3
maxBlock("") → 0


source

solution:

public int maxBlock(String str) {
  int block =1 , largestBlock=0 ;
  
  if(str.length()==0) return 0;
  
  for(int i=0 ; i<str.length(); i++){
     while(i+1<str.length() && str.charAt(i)==str.charAt(i+1) ){
     
         block++;i++;
             
     }
     
     if(block>largestBlock) largestBlock=block;
     block=1;
  }
  return largestBlock;
}

Tuesday, May 11, 2010

jTatoo - Nifty Java Swing look and feel themes


JTattoo consists of several different Look and Feels classes for Swing applications. Which enable developers to improve their application with an excellent user interface. So JTattoo opens desktop applications the door to end users who are unsatisfied with the Look and Feels shipped with the standard JDK. It's free for private and non-commercial use. here are some of the Look and feel classes available.







 To download jTatoo.jar and sources click here . Usage information can be found at howto 
 page. If you wanna iterate through available look and feels in jTatoo download this demo and run LookandFeeldemo.jar . 

Saturday, May 8, 2010

mirrorEnds: solutions for Javabat: 17



Given a string, look for a mirror image (backwards) string at both the beginning and end of the given string. In other words, zero or more characters at the very begining of the given string, and at the very end of the string in reverse order (possibly overlapping). For example, the string "abXYZba" has the mirror end "ab".

mirrorEnds("abXYZba") → "ab"
mirrorEnds("abca") → "a"
mirrorEnds("aba") → "aba"

Source

I used separate method for reverse a given string for it can be reused. one can use StringBuffer or StringBuilder too because those classes have reverse method built in.

public String mirrorEnds(String str) {
  
 String mir="";
 if(str.length()<2) return str;
 int k=1;
   while(str.substring(str.length()-k).equals(this.reverse(str.substring(0,k)))){
      mir=str.substring(0, k);
      k++;
      if(k> str.length()) break; 
      // for overlapping is allowed!
   }
        return mir;
 }
 String reverse(String str){
     String rev="";
     int i=str.length();
     while(--i>=0)
        rev+= str.charAt(i)
        
     return rev;
 }
 

 
 
Blogger Templates http://slots.to/