Sunday, June 30, 2019

attiny 13 - 85 Extention Board

attiny 13 - 85 Extention Board



 I have recently desinged and ordered some pcb's from jlc pcb, pcb is for extending attiny13-85 chips out put pins using shiftregisters. after i have recived them i have assembeled them and carried out a test run.things turn out to be great and they worked as expected. beleow are some pictures of the test.in this test i have used attiny85 and arduino code to test run it.






UPS Trnsfomer Based Power Supply

UPS Trnsfomer Based Power Supply


 I needed a powerfull power supply that can power few stuff parallelly at the same time, instead of buying one i decided to buil a one. with the previous working experience i knew a ups transfomer is suitable for this kind of thing.so i have teared up a old ups and got a transfomer.then i hand drawn the PCB for smoothing (rectifiying) circuit.i have used 2x 2200uf caps and "MOSPEC" diode for rectifiying the power comes out from the transfomer.after that i have packed it inside of a plastic box for safty and easy handling. Power comes out from this power supply can handle up to 4A without problem.




 

DIY RGB Mood lamp Build

DIY RGB Mood Lamp Build



This is a project that have been waited long time to be done.recently i have accomplished the project.most of the material used in this project is easly acquirable in the local market.

i have used :

3.5 inches PVC joint sockets
transformer insulation paper
switch
dc jack base
pic12f675 and some electronic components
RGB stripe
some MDF wood and pvc pipe & some gloo gum.

its low cost and nice looking after finishing !




Thursday, June 13, 2019

change java swing table cell color

changing  java swing table cell color according to cell value


Recently i wanted to change cell color of a jTable cell according to value it contains.this is the soulution i came up with.


This is acquired by using custom cell renderer class and overriding getTableCellRendererComponent method.

inner class :

class MyTableCellRenderer extends DefaultTableCellRenderer {

    @Override
    public Color getBackground() {
        return super.getBackground();
    }
}





adding the color change :

 public void changeTable(JTable table, int column_index) {
        table.getColumnModel().getColumn(column_index).setCellRenderer(new DefaultTableCellRenderer() {
            @Override
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                final Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                int st_val = Integer.parseInt(table.getValueAt(row, 2).toString());
                int req_val = 2000;
                if (st_val < req_val) {
                    c.setBackground(Color.MAGENTA);
                } else {
                    c.setBackground(Color.GREEN);
                }
                return c;
            }
        });
    }


to scroll down to the added row i have added component listner and a component adaptor.


in action : https://www.youtube.com/watch?v=GD5J25I56xA


github : https://github.com/stark9000/jTable_cell_color



Monday, June 10, 2019

populating jTable data and structure dynamically using data from mysql database.

populating jTable data and structure dynamically using data from mysql database.




As you can see in the pictures, in this one letss see how to populate jTable with data from mysql database dynamically.when changing data it's important to change the column names according to
the table we load data from.in this example i have added that functionality as well. the code is rather long, so i won't post it here, you can grab a copy from github.

in action : https://www.youtube.com/watch?v=zaXWutIWKG0

github : https://github.com/stark9000/MYSQL_JAVA_SWING