tag:blogger.com,1999:blog-2453846005760740432024-03-14T17:48:11.903+05:30CS HOT TOPICSCS HOT TOPICS discussed some really hot topics of computer programming specially in the areas of open source technology. CS HOT TOPICS is growing day by day with lot of new contents.Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-245384600576074043.post-52807357381870178052016-01-22T22:39:00.001+05:302016-01-23T16:17:40.840+05:30How to use Ajax request<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<!--<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/10/how-to-create-dynamic-table.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="how to create dynamic table?" type="button" value="<<" /> -->
<br />
<div style="color: black; font-size: 16px; line-height: 160%; text-align: justify; text-shadow: 0px 1px 1px rgb(77, 77, 77);">
This is the program which shows how to fetch data from server using ajax (without any page refresh).
<br />
<br />
<pre class="html" name="code"><!DOCTYPE>
<html>
<head>
<!-- google ajax library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<!-- if you want to use your own jQuery library then download and use it. -->
<!--<script src="jquery-1.11.1.min.js"></script>-->
<script language="javascript">
$(function(){
$.ajax({
type : 'POST',
url : 'ajax.php',
//if you need to send data to ajax.php through ajax then remove the comment.
//data: {'appid':appid},
success : function (d) {
alert("Server Date: "+d);
//$("div#size").html(d);
},
error : errorHandler
});
});
//error handler
function errorHandler(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (exception === 'timeout') {
alert('Time out error.');
} else if (exception === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error.\n' + jqXHR.responseText);
}
}
</script>
</head>
<body>
</body>
</html></pre>
<br />
<b>ajax.php code:</b>
<br />
<br />
<pre class="html" name="code"><?php
echo date("d-m-Y");
?>
</pre>
<br />
Note: As soon as you run this program in browser you will get
your server's current time in alert box.
<br />
<br />
Here is the Output:
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVind4qSLlkjdWzV7J9R-ScI1bh0VS1jwmb362E2jIr1N6tx2vkGWYMlw762oytqVKnClza5jxQpnOY7mE-VgQi-kyg3A7PtbGSMOy6_PYt5dLlcfe_lJ19RMyd9OCPHLBUqewwSirlMo/s1600/ajax.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVind4qSLlkjdWzV7J9R-ScI1bh0VS1jwmb362E2jIr1N6tx2vkGWYMlw762oytqVKnClza5jxQpnOY7mE-VgQi-kyg3A7PtbGSMOy6_PYt5dLlcfe_lJ19RMyd9OCPHLBUqewwSirlMo/s640/ajax.png" width="640" /></a></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/12105939320375223359noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-22385406517166351812014-12-12T20:39:00.002+05:302014-12-12T20:46:22.819+05:30How to Validate Image Extension in JavaScript ?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/10/how-to-create-dynamic-table.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="how to create dynamic table?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-edit-and-display-combobox-item.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to edit and display combobox item in java?" type="button" value=">>" />
-->
<br />
<div style="color: black; font-size: 16px; line-height: 160%; text-align: justify; text-shadow: 0px 1px 1px rgb(77, 77, 77);">
<pre class="html" name="code"><!DOCTYPE>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Image extension validation in javascript</title>
<script type="text/javascript">
function checkExtension(filename)
{
var n= filename.lastIndexOf(".");
if(n != -1) //which means filename has .
{
var st= filename.substring(n);
if(st==".jpg" || st==".jpeg" || st==".png" || st==".gif")
{ //correct extension
return true;
}
else
{
//incorrect extension
return false;
}
}
else
{
//filname don't contains .
return false;
}
}
function check()
{
var fname=document.frm.filename.value;
if(fname=='')
{
alert('select image')
return false;
}
else if(checkExtension(fname))
return true;
else
{
alert('Invalid image file. Should be a image !!!')
return false;
}
}
</script>
</head>
<body>
<h1 align="center">Image extension validation in javascript.</h1>
<div align="center">
<form name="frm" onsubmit="return check()" method="post" action="go.html">
Select File:
<input type="file" name="filename" id="filename" />
<br/> <br/>
<input type="submit" />
</form>
</div>
</body>
</html> </pre>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4EJVSRxpTUlzTVa-veylEns_51L6FLIlPBp1p3BrdfmoWVxC0gMuw1RTn0_q_2t3QyjYxWqfoLQQhGAZiuCnY0mRU6FjRh4254c9ZGXZxc7w4D36Q-mpgNLlAO5d3f-I5jLyqdEvh2evJ/s1600/imagevalidation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4EJVSRxpTUlzTVa-veylEns_51L6FLIlPBp1p3BrdfmoWVxC0gMuw1RTn0_q_2t3QyjYxWqfoLQQhGAZiuCnY0mRU6FjRh4254c9ZGXZxc7w4D36Q-mpgNLlAO5d3f-I5jLyqdEvh2evJ/s1600/imagevalidation.png" height="360" width="640" /></a></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-69130609630533919332014-11-27T18:04:00.000+05:302014-12-07T14:07:47.956+05:30simple pagination in php<div dir="ltr" style="text-align: left;" trbidi="on">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- cshotopics_main_Blog1_300x250_as -->
<br/>
<ins class="adsbygoogle" style="display:inline-block;width:950px;height:130px" data-ad-client="ca-pub-8967888204592599" data-ad-slot="6592040860"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<!-- add close -->
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/11/how-to-send-mail-in-php-from-localhost.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="how to send mail in php from localhost?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-use-list-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use list in java ?" type="button" value=">>" />
-->
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
Below is the code to do a simple pagination in php:
<br />
<br />
<pre class="php" name="code"><?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$rec_limit = 5;
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydatabase');
/* Get total number of records */
$sql = "SELECT count(prd_code) as count_prd FROM Product_tab";
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
$row = mysql_fetch_array($retval );
$rec_count = $row['count_prd'];
if( isset($_GET{'page'} ) )
{
$page = $_GET{'page'} + 1;
$offset = $rec_limit * $page ;
}
else
{
$page = 0;
$offset = 0;
}
$left_rec = $rec_count - ($page * $rec_limit);
$sql = "SELECT prd_code,prd_name,prd_price from product LIMIT $offset, $rec_limit";
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval))
{
echo "Product id :{$row['prd_code']} <br> ".
"Product name :{$row['prd_name']} <br> ".
"Price : {$row['prd_price']} <br> ". "--------------------------------<br>";
}
if( $page > 0 && !($left_rec < $rec_limit) )
{
$last = $page - 2;
echo "<a href=\"$_PHP_SELF?page=$last\">Previous 5 Records</a> |";
echo "<a href=\"$_PHP_SELF?page=$page\">Next 5 Records</a>";
}
else if( $page == 0 )
{
echo "<a href=\"$_PHP_SELF?page=$page\">Previous 5 Records</a>";
}
else if( $left_rec < $rec_limit )
{
$last = $page - 2;
echo "<a href=\"$_PHP_SELF?page=$last\">Previous 5 Records</a>";
}
mysql_close($conn);
?>
</pre>
<br />
<br />
See the effect here:<br />
<br />
First page: <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfJn5MN3llwnFedm1SLmS3dibWXV867rqKxvJvGcyLRiKlUm1Q7cdfaFhEG-n7CSs9YSNDRnoY3g5t94QiE63PGHasIb9_HGyqNr70xMOQriJNAHSzs4rgoGsdTNSYRDIlRCtY4j83lgEt/s1600/pagination.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfJn5MN3llwnFedm1SLmS3dibWXV867rqKxvJvGcyLRiKlUm1Q7cdfaFhEG-n7CSs9YSNDRnoY3g5t94QiE63PGHasIb9_HGyqNr70xMOQriJNAHSzs4rgoGsdTNSYRDIlRCtY4j83lgEt/s1600/pagination.png" height="358" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Middle page: <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv4rczM0MlQGXJRgzbrf-N09KJ_Ekrc1VfqD1MAzNQE_d4MXHI7K4udKwKwLBmI8Y2Tca0RYxbP1ljOJQPv9tEbCDobwWOnBn45Mlq-c9dx6VJBm6LjvTrJO7ndU4b_Ndti64fnAbPDRXN/s1600/pagination1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv4rczM0MlQGXJRgzbrf-N09KJ_Ekrc1VfqD1MAzNQE_d4MXHI7K4udKwKwLBmI8Y2Tca0RYxbP1ljOJQPv9tEbCDobwWOnBn45Mlq-c9dx6VJBm6LjvTrJO7ndU4b_Ndti64fnAbPDRXN/s1600/pagination1.png" height="358" width="640" /></a></div>
<br />
Last page: <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5ulBAXJXXTF9m8giHmtr_pU0vCn1nEK8PUNOvS1kCTc5oPrQZK37xQLsR3O4-jqdYraYweSAhA2RB_l1o3wdLcbqLYifBzytRAP8OLAH1y9vVxhEckrO1bL9E_Cg0rzf4WX9gsI_kFw0r/s1600/pagination2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5ulBAXJXXTF9m8giHmtr_pU0vCn1nEK8PUNOvS1kCTc5oPrQZK37xQLsR3O4-jqdYraYweSAhA2RB_l1o3wdLcbqLYifBzytRAP8OLAH1y9vVxhEckrO1bL9E_Cg0rzf4WX9gsI_kFw0r/s1600/pagination2.png" height="358" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</div>
<br />
<!-- google add -->
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- cshotopics_main_Blog1_300x250_as -->
<br/>
<ins class="adsbygoogle" style="display:inline-block;width:950px;height:200px" data-ad-client="ca-pub-8967888204592599" data-ad-slot="6592040860"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<!-- add close -->
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-70048041740060976482014-11-27T17:17:00.002+05:302014-12-09T13:14:08.042+05:30About me<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<!--
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/java-how-to-use-jframe-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use JFrame in java?" type="button" value="<<" />
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-use-list-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use list in java ?" type="button" value=">>" />
-->
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiUJmYSthIt3G_6vi9hajewfShUDL-ElWbHPlqP8fhs57QJkdqhL8X5eXvblxpc-p8YkythqV_-IYGZhUOcMUzwAWkfnlq2uxazhHzfIxpwVe-F3X6XeyrMaNOf9XTSr7nn2QfJWjkx6Bp/s1600/avnish+alok2.jpg" style="margin-left: 1em; margin-right: 1em;" tartet="_blank"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiUJmYSthIt3G_6vi9hajewfShUDL-ElWbHPlqP8fhs57QJkdqhL8X5eXvblxpc-p8YkythqV_-IYGZhUOcMUzwAWkfnlq2uxazhHzfIxpwVe-F3X6XeyrMaNOf9XTSr7nn2QfJWjkx6Bp/s1600/avnish+alok2.jpg" height="400" width="300" /></a></div>
<br />
That's me <b style="mso-bidi-font-weight: normal;">Avnish Alok</b>, the guy behind this blog, a Software Engineer, Blogger, Freelancer and a true technology geek indeed. I
believe in the ideology of <b style="mso-bidi-font-weight: normal;">BENJAMIN
FRANKLIN</b> great quote "<b><i style="mso-bidi-font-style: normal;">He that
can have patience can have what he will</i></b>". I retain all such qualities
to be a technology geek i:e; spend my much more time with computer, treating my pc as a family member, awake up at every morning with more passion to know
about new tools & technologies, dig deeply to know more about each stuff.<br />
Apart
from my profession i love to write poems and reading novels as well. I write poems of genres like
inspirational and romantic.<br />
<br />
I hold my PG degree(MCA) in Information Technology and planning to do P.H.D in the same. As I’m
a blogger, it is obvious to do blogging so, <b style="mso-bidi-font-weight: normal;">CS HOT TOPICS</b> is the outcome. With the help of this blog I share my knowledge to my friends, my colleagues and to the entire world. <span style="mso-spacerun: yes;"> </span><br />
<br />
<br />
<span style="mso-spacerun: yes;"><b><span style="color: red;">ABOUT CS HOT TOPICS:</span></b> </span>
<br />
<b><a href="http://www.cshotopics.blogspot.com/" target="_blank">CS HOT TOPICS</a></b> is a technical blog for open source
enthusiasts that always updates with latest tools & technologies. As the name
suggest it covers hot topics of computer programming in various languages(java,
jsp, servlet, php, mysql, oracle) to name a few with latest tools(ajax, jquery).
You can get more to visit here <a href="http://cshotopics.blogspot.com/" target="_blank">http://cshotopics.blogspot.com/</a><br />
<br />
You can
follow me on <a href="https://plus.google.com/101865839143770668502" target="_blank">Google+</a>,
<a href="https://www.facebook.com/cshotopics" target="_blank">Facebook</a> and <a href="https://twitter.com/Cs_hot_topics" target="_blank">Twitter</a>, If you’d like to dig more
about me.<br />
<br />
If you’ve
any Queries about Add. and content Posting, or want to provide me your feedback
so that i can improve this blog further, feel free to email me at <a href="mailto:avnishalok.se@gmail.com">avnishalok.se@gmail.com</a>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-27544534039025659932014-11-26T13:49:00.001+05:302014-12-09T13:12:28.430+05:30how to configure xampp to send mail in php?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/10/what-is-php.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="What is PHP?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/11/how-to-send-mail-in-php-from-localhost.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="how to send mail in php from localhost?" type="button" value=">>" />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
In order to send mail, you have to make some changes in your files if you are using XAMPP. Configure two files, first one is <span style="color: red;"><code>C:\xampp\php\php.ini</code></span> and the second one is <span style="color: red;"><code>c:\xampp\sendmail\sendmail.ini</code></span> <br />
<br />
In <span style="color: red;"><code>C:\xampp\php\php.ini</code></span> find <span style="color: red;"><code>extension=php_openssl.dll</code></span> and remove the semicolon from the beginning of that line to make SSL working for mailing sites like gmail for your localhost.
<br />
<br />
In php.ini file find <code>[mail function]</code> and change<br />
<br />
<div style="background: #d3d3d3;">
<pre class="lang-php prettyprint prettyprinted"><code><span class="pln">SMTP</span><span class="pun">=</span><span class="pln">smtp</span><span class="pun">.</span><span class="pln">gmail</span><span class="pun">.</span><span class="pln">com
smtp_port</span><span class="pun">=</span><span class="lit">587</span><span class="pln">
sendmail_from </span><span class="pun">=</span><span class="pln"> </span><span class="pln">gmail</span><span class="pun">-</span><span class="pln">id@gmail</span><span class="pun">.</span><span class="pln">com
sendmail_path </span><span class="pun">=</span><span class="pln"> </span><span class="str">"\"C:\xampp\sendmail\sendmail.exe\" -t"</span></code></pre>
</div>
<br />
<br />
Now Open <span style="color: red;"><code>C:\xampp\sendmail\sendmail.ini</code></span>. Replace all the existing code in sendmail.ini with following code<br />
<br />
<div style="background: #d3d3d3;">
<pre class="lang-php prettyprint prettyprinted"><code><span class="pun">[</span><span class="pln">sendmail</span><span class="pun">]</span><span class="pln">
smtp_server</span><span class="pun">=</span><span class="pln">smtp</span><span class="pun">.</span><span class="pln">gmail</span><span class="pun">.</span><span class="pln">com
smtp_port</span><span class="pun">=</span><span class="lit">587</span><span class="pln">
error_logfile</span><span class="pun">=</span><span class="pln">error</span><span class="pun">.</span><span class="pln">log
debug_logfile</span><span class="pun">=</span><span class="pln">debug</span><span class="pun">.</span><span class="pln">log
auth_username</span><span class="pun">=</span><span class="pln">gmail</span><span class="pun">-</span><span class="pln">id@gmail</span><span class="pun">.</span><span class="pln">com
auth_password</span><span class="pun">=</span><span class="pun"></span><span class="pln">gmail</span><span class="pun">-</span><span class="pln">password
force_sender</span><span class="pun">=</span><span class="pun"></span><span class="pln">gmail</span><span class="pun">-</span><span class="pln">id@gmail</span><span class="pun">.</span><span class="pln">com</span></code></pre>
</div>
<br />
<span style="color: red;">Note:</span> Replace <b>gmail-id</b> and <b>gmail-password</b> in above code <code>with</code> yours.<br />
<br />
<span style="color: red;">Note:</span> If you are unable to send mail using your gmail accout then you need to make some changes in your gmail account setting like change Access for less secure apps must be enable. Login into your gmail accout and follow the link <a href="https://www.google.com/settings/security/lesssecureapps">Gmail setting for less secure apps</a> to configure your gmail account setting.<br />
<br />
<span style="color: red;"><a href="http://cshotopics.blogspot.in/2014/11/how-to-send-mail-in-php-from-localhost.html">Click here to get code to send mail using php</a></span> </div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-2856419426758893912014-11-26T13:10:00.000+05:302014-12-09T13:12:54.072+05:30how to send mail in php from localhost?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/11/how-to-configure-xampp-to-send-mail-in.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="how to configure xampp to send mail in php?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/11/simple-pagination-in-php.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="simple pagination in php" type="button" value=">>" />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
In previous chapter you got idea to configure your XAMPP. If you've configured then move to code to send mail and if not then configure at first. <a href="http://cshotopics.blogspot.in/2014/11/how-to-configure-xampp-to-send-mail-in.html" target="_blank">click here to configure.</a><br />
Now it's time to write code in order to send mail. Below is the code to send mail using php:<br />
<br />
<pre class="java" name="code"><?php
$to = "your-gmail-id@gmail.com";
$subject = "HTML email using PHP";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This is an HTML Email send using php mail function.</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Avnish</td>
<td>alok</td>
</tr>
</table>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <your-gmail-id@gmail.com>' . "\r\n";
$chk=mail($to,$subject,$message,$headers);
if($chk)
echo "success";
else
echo "fail";
?>
</pre>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-30305717636718370402014-11-24T13:54:00.000+05:302014-12-09T13:14:51.072+05:30Write For Us<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<!--
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/java-how-to-use-jframe-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use JFrame in java?" type="button" value="<<" />
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-use-list-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use list in java ?" type="button" value=">>" />
-->
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik-5KysTfSwDXjrmpLQZ0gF5KWm5mNCFmkJzKXnPX7DjzR9rFkAkhNbTOLPieNl1YAFYG7uEHVvjwIJrNwpBjXya19vjrltixa8mlHdAs0_W8QBT3ZYKdwpJ_WSu5yXYghuG2-AAEV56tQ/s1600/cshottopics.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik-5KysTfSwDXjrmpLQZ0gF5KWm5mNCFmkJzKXnPX7DjzR9rFkAkhNbTOLPieNl1YAFYG7uEHVvjwIJrNwpBjXya19vjrltixa8mlHdAs0_W8QBT3ZYKdwpJ_WSu5yXYghuG2-AAEV56tQ/s1600/cshottopics.png" height="114" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<span style="color: red;"><a href="http://cshotopics.blogspot.com/">CS HOT TOPICS</a></span> is open for guest posts and blog advertisement now. If you want to write for us on computer programming and its related technologies, kindly contact us at <span style="color: red;"><a href="mailto:avnishalok.se@gmail.com">avnishalok.se@gmail.com</a></span>.<br />
After getting your post we'll review it and if it looks good then we'll publish your post within 2 working days. Below are the list of topics for which you can write for us:<br />
<br />
<ul style="text-align: left;">
<li>Computer languages and its related technologies</li>
<li>Mobile technology</li>
<li>Technical support </li>
</ul>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-80854504918543297622014-10-28T23:54:00.001+05:302014-12-09T13:15:35.306+05:30how to import database into oracle?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/10/how-to-import-and-export-database-in.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="how to export database in oracle?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-use-checkbox-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use checkbox in java?" type="button" value=">>" />
-->
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
Import schemas(table,view,trigger,cursor etc.) into Oracle:<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwowVtE15sbTgvZHphrcGaR4KRp3jsrPQOFGuM83TIQtlcN47SVmGh8Rpb13W0cRZcq7OF9BH3alczvqK4QZuda5hLA3l2BP_z1ATtHwoE80lo8rO400yBCWJhp4ZhGneddiqhwpXM-6nH/s1600/index.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwowVtE15sbTgvZHphrcGaR4KRp3jsrPQOFGuM83TIQtlcN47SVmGh8Rpb13W0cRZcq7OF9BH3alczvqK4QZuda5hLA3l2BP_z1ATtHwoE80lo8rO400yBCWJhp4ZhGneddiqhwpXM-6nH/s1600/index.jpg" height="122" width="320" /></a>There are two ways to import shcemas.<br />
1. Using Directory<br />
2. Without using Directory<br />
<br />
<span style="color: red;"><b>1. Using Directory:-</b></span> <br />
<br />
<div style="text-align: justify;">
<span style="color: red;">Step i.</span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"> Create a folder at first in any drive.</span></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;">Step ii.</span> </span> </span></div>
<div style="text-align: justify;">
<span style="color: red;"> <span style="color: black;">Open SQL prompt and create a directory using given syntax:</span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"> <span style="color: red;">SQL> create directory directory-name as folder-name</span></span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"> <span style="color: black;">where directory-name is any name and folder-name must be what you've created</span></span> in step 1.</span></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;">Step iii. </span></span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"> <span style="color: black;">Exit from sql prompt and write import command at command prompt using given synatx:</span></span></span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"> <span style="color: red;">C:\> impdp User/password dumpfile=file-name.dmp directory=directory-name remap_schema=Old User:New User</span></span></span></span></span></span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: red;"> <span style="color: black;">where
User is user-name with import privilege, password is the password for
that user, file name is exported dump file name with extension .dmp,
directory-name is the same name what you created in step ii. and for remap_schema, old
user is the user for which you exported already the schema(table, view, function
etc.) and NewUser the user for which u want to import database.</span></span></span></span></span></span></span></span></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-49086728039666816452014-10-24T01:24:00.001+05:302014-12-09T13:16:08.689+05:30how to export database in oracle?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<!--
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-edit-and-display-combobox-item.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to edit and display combobox item in java?" type="button" value="<<" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/10/how-to-import-database-into-oracle.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="how to import database into oracle?" type="button" value=">>" />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
Export schemas(table,view,trigger,cursor etc.) from Oracle: <br />
<br />
There are two ways to export shcemas.<br />
1. Using Directory<br />
2. Without using Directory<br />
<br />
<b><span style="color: red;">1. Using Directory:- </span></b>
<br />
<div style="text-align: justify;">
<span style="color: red;">Step i.</span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"> Create a folder at first in any drive.</span></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;">Step ii.</span> </span> </span></div>
<div style="text-align: justify;">
<span style="color: red;"> <span style="color: black;">Open SQL prompt and create a directory using given syntax:</span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"> <span style="color: red;">SQL> create directory directory-name as folder-name</span></span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"> <span style="color: black;">where directory-name is any name and folder-name must be what you've created</span></span> in step 1.</span></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;">Step iii. </span></span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"> <span style="color: black;">Exit from sql prompt and write export command at command prompt using given synatx:</span></span></span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"> <span style="color: red;">c:\> expdp User/password dumpfile=file-name.dmp directory=directory-name schemas=User</span></span></span></span></span></span></span></div>
<div style="text-align: justify;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: red;"> <span style="color: black;">where User is user-name with export priviledge, password is the password for that user, dump file name is any file name with extension .dmp, directory-name is the same name what you created in step ii. and schemas user is for which you want to export schemas(tables, views, function etc.) </span> </span></span></span></span></span></span></span></div>
<br />
<span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: red;"> Example:-</span></span></span></span></span></span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="color: red;"><span style="color: black;"><span style="color: red;"><span style="color: black;"><span style="color: black;"><span style="color: red;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-5L1hHVm2s63fjXWoC80vvXHAvWVXSknZZ-9T1fB5hSg57xLBJFAVxLoBZamoITnKInNnqwvWvhg4YOYWdolGuwAb3cHrPOwtpJs5ONnxj6jZi9rHil_Ll6S5bMtWygPdZE88v07tvrtH/s1600/Picture2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-5L1hHVm2s63fjXWoC80vvXHAvWVXSknZZ-9T1fB5hSg57xLBJFAVxLoBZamoITnKInNnqwvWvhg4YOYWdolGuwAb3cHrPOwtpJs5ONnxj6jZi9rHil_Ll6S5bMtWygPdZE88v07tvrtH/s1600/Picture2.png" height="398" width="640" /></a></span></span></span></span></span></span></div>
<span style="color: red;"><span style="color: black;"><span style="color: red;"> </span></span></span><br />
<div style="clear: both;">
<span style="color: red;">Here is the exported dump file:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuvaaXMvUVlTgL51fnvFnvhdPaW8N5QeQus5RRzukoVZ2Hcp5R2tlbfq1MMbhxae0il09x-y1WvDYYf3bgN-3tYVVeVsEqUFTfInJJZ3oBW4TyaEjqXX73ycZHc2kO3dVb6sTqB09d77Ae/s1600/drive.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuvaaXMvUVlTgL51fnvFnvhdPaW8N5QeQus5RRzukoVZ2Hcp5R2tlbfq1MMbhxae0il09x-y1WvDYYf3bgN-3tYVVeVsEqUFTfInJJZ3oBW4TyaEjqXX73ycZHc2kO3dVb6sTqB09d77Ae/s1600/drive.png" height="408" width="640" /></a></div>
<br />
<br />
<br />
<br />
<div style="clear: both;">
<br />
<br />
<br />
<b><span style="color: red;">2. Without using Directory: </span></b></div>
<br />
<div style="text-align: justify;">
Remove (directory=directory-name) attribute from step iii above. So, syntax would be like this:</div>
<div style="text-align: justify;">
<span style="color: red;">Syntax:</span></div>
<div style="text-align: justify;">
<span style="color: red;"> C:\>expdp user/password dumpfile=dump-file-name schemas=User</span></div>
<div style="text-align: justify;">
This time the dump file location would be default location of oracle. I'm using 10g express edition so my default file location is 'c:\oraclexe\app\oracle\admin\xe\dpdump\dump-file.dmp'. Default location may vary according to version. On command prompt see the 2nd line from last. This is your default dump-file location.</div>
<br />
Example:
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx_x0B_Xe65oelVyBFIGWv-Uq4ttUiY9vtwXH4fiffLJ5vvB4fv2lTmbzhLXRl_sKbK7OZTkvkihEB0-FLrB0JLJ7nEwmRoe0n7uIT53_-woi-KxX9_0RJryy1kg9iJqOU6uSWZopFLmHx/s1600/Picture1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx_x0B_Xe65oelVyBFIGWv-Uq4ttUiY9vtwXH4fiffLJ5vvB4fv2lTmbzhLXRl_sKbK7OZTkvkihEB0-FLrB0JLJ7nEwmRoe0n7uIT53_-woi-KxX9_0RJryy1kg9iJqOU6uSWZopFLmHx/s1600/Picture1.png" height="368" width="640" /></a></div>
<div style="clear: both;">
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-87791856639949857082014-10-17T14:08:00.002+05:302014-12-12T20:40:46.125+05:30how to create dynamic table?<div dir="ltr" style="text-align: left;" trbidi="on">
<!--
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/java-how-to-use-jframe-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use JFrame in java?" type="button" value="<<" />
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/12/how-to-validate-image-extension-in.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to Validate Image Extension in JavaScript ?" type="button" value=">>" />
<br />
<br />
<div style="color: black; font-size: 16px; line-height: 160%; text-align: justify; text-shadow: 0px 1px 1px rgb(77, 77, 77);">
Sometimes ago, when i was developing a Web Application then i'd need to create dynamic table. I did google but nothing found useful for me. Then i decided to develop it by myself. Although it took some great time but yes, the outcome was fabulous.<br />
Here is the code. </div>
<div style="text-align: center;">
<u><b><span style="font-size: large;">Dyntable.js</span></b></u>
</div>
<pre class="javascript" name="code">function getVal()
{
var val=document.frm.txt1.value
var str="<table border='2'><tr>
<th nowrap='nowrap'><font color='blue' size='2'>Item 1</font></th>
<th><font color='blue' size='2'>Item 2</font></th>
<th><font color='blue' size='2'>Item 3</font></th>
</tr>"
//validation logic for each table's cell
var b=0;
while(val>0)
{
str=str+"<tr><td>
<input type='text' name='jtext"+ ++b
+"' onBlur='if(isNaN(this.value)){
alert(\"value must be numeric !!!\")
}
else if(this.value<=0)
{ alert(\"Value must be greater than zero !!!\")
} '/></td><td><input type='text' name='jtext"+ ++b
+"' onBlur='if(isNaN(this.value)){
alert(\"value must be numeric !!!\") }
else if(this.value<=0) {
alert(\"Value must be greater than zero !!!\")
} '/></td><td>
<input type='text' name='jtext"+ ++b +"'
onBlur='if(isNaN(this.value)){
alert(\"value must be numeric !!!\") }
else if(this.value<=0) {
alert(\"Value must be greater than zero !!!\") } '/>
</td></tr>";
val--;
}
str=str+"</table>";
document.getElementById("spn").innerHTML=str;
}
</pre>
<div style="text-align: center;">
<br />
<u><b><span style="font-size: large;">Htmlcode.html</span></b></u>
</div>
<br />
<pre class="html" name="code"><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dynamic table</title>
</head>
<script language="javascript" src="Dyntable.js"> </script>
<body>
<center>
<h1>Dynamic table</h1>
<form name="frm">
<input type="text" size="20" name="txt1">
</br></br>
<input type="button" value="ok" name="okbtn" onclick='getVal()'>
</form>
<p>
<span id="spn"></span>
</center>
</body>
</html>
</pre>
<br />
<br />
<div style="font-size: 18px; font: Verdana, Arial, Helvetica, sans-serif; opacity: 0.7; text-shadow: 0px 1px 1px #4d4d4d;">
Here is Output:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-UNBUrBwYDGXED69qak0tDFVefnM0gwjn06ugY4Tvi1qW5V_8Gn-YLg1k9yQixHW1O1MPa_sceuJFEUscbjgucGCOY4ljjRJNREATlRrjRC-LEaMvfvZ9cKZz99qvEznaynfshc7bKErj/s1600/dynamictable.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje5qHGh1U1pFQva7uljLQ-u0o8bcaFbYaxkIJBAOQo4TQgYyvACyekUKN10-mgmmJGPd0TSUXrs3jiPwex2EF4WwUVjAHWk5vpon8m5LVt5hl6aIGRsOz_wKi-mNW7GweTMztUXpk4bt4e/s1600/dynamictable.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje5qHGh1U1pFQva7uljLQ-u0o8bcaFbYaxkIJBAOQo4TQgYyvACyekUKN10-mgmmJGPd0TSUXrs3jiPwex2EF4WwUVjAHWk5vpon8m5LVt5hl6aIGRsOz_wKi-mNW7GweTMztUXpk4bt4e/s1600/dynamictable.png" height="360" width="640" /></a></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-38706863212321117382014-10-11T03:36:00.002+05:302014-12-09T13:13:21.126+05:30what is php?<div dir="ltr" style="text-align: left;" trbidi="on">
<!--
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/java-how-to-use-jframe-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use JFrame in java?" type="button" value="<<" />
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/11/how-to-configure-xampp-to-send-mail-in.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="how to configure xampp to send mail in php?" type="button" value=">>" />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<br />
<b><span style="color: red;">ABOUT PHP:</span></b><br />
<br />
<div style="text-align: justify;">
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source server-side scripting language that is especially suited for web development and can be embedded directly into HTML. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features. The goal of the language is to allow web developers to write dynamically generated pages quickly.</div>
<div style="text-align: justify;">
As of January 2013, PHP was installed on more than 2.1 million web servers. PHP was Originally developed by <b>Rasmus Lerdorf</b> in <b>1994</b>. PHP code can be simply mixed with HTML code, or it can be used in combination with various templating engines and web frameworks.</div>
<br />
<span style="color: red;"><b>PHP VERSION:</b></span><br />
<br />
<table align="center" border="1" cellpadding="5" cellspacing="0">
<tbody>
<tr>
<th><span style="color: red; font-weight: normal;">VERSION</span></th>
<th><span style="color: red; font-weight: normal;">RELEASED DATE</span></th>
</tr>
<tr>
<td>1.0</td>
<td>8 June 1995</td>
</tr>
<tr>
<td>2.0</td>
<td>1 November 1997</td>
</tr>
<tr>
<td>3.0</td>
<td>6 June 1998</td>
</tr>
<tr>
<td>1.7</td>
<td>July 19, 2011</td>
</tr>
<tr>
<td>2.5</td>
<td>January 24, 2012</td>
</tr>
<tr>
<td>3.0</td>
<td>September 27, 2012</td>
</tr>
<tr>
<td>4.0</td>
<td>22 May 2000</td>
</tr>
<tr>
<td>4.1</td>
<td>10 December 2001</td>
</tr>
<tr>
<td>4.2</td>
<td>22 April 2002</td>
</tr>
<tr>
<td>4.3</td>
<td>27 December 2002</td>
</tr>
<tr>
<td>4.4</td>
<td>11 July 2005</td>
</tr>
<tr>
<td>5.0</td>
<td>13 July 2004</td>
</tr>
<tr>
<td>5.2</td>
<td>2 November 2006</td>
</tr>
<tr>
<td>5.3</td>
<td>30 June 2009</td>
</tr>
<tr>
<td>5.4</td>
<td>1 March 2012</td>
</tr>
<tr>
<td>5.5</td>
<td>20 June 2013</td>
</tr>
</tbody></table>
<br />
<span style="color: red;"><b>SYNTAX:</b></span><br />
<br />
<b>The following Hello world program is written in PHP code embedded in an HTML document:</b><br />
<b> </b>
<br />
<pre class="html" name="code"><!DOCTYPE html>
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
</pre>
<br />
<div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-37262231793510539052014-10-10T07:10:00.000+05:302014-12-09T13:17:00.133+05:30how to install joomla?<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- add close -->
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<b style="color: red; font-size: x-large;">Installing Joomla!</b><br />
<span style="font-size: medium;"><br /></span>
<span style="font-size: medium;">Download the Joomla! 3.0.x full package at http://www.joomla.org/download.html</span><br />
<span style="font-size: medium;">Create a new folder entitled “Joomla30” in folder “htdocs” in XAMPP folder. Normally it will be located at “C:\xampp\htdocs”</span><br />
<span style="font-size: medium;">Unpack the downloaded package file into the folder “Joomla30”</span><br />
<span style="font-size: medium;">Go to the URL “http://localhost/Joomla30”</span><br />
<span style="font-size: medium;">Follow all steps in Joomla! installation:</span><br />
<span style="font-size: medium;"><br /></span>
<span style="color: red; font-size: medium;">Step 1. Main Configuration</span><br />
<br />
<ul style="text-align: left;">
<li><span style="font-size: medium;">Select Language: Choose your own language in the drop-down menu, for example, “English (United States)”</span></li>
<li><span style="font-size: medium;">Site Name: Enter the name of your site</span></li>
<li><span style="font-size: medium;">Description: Enter the description of your site</span></li>
<li><span style="font-size: medium;">Site Offline: Choose status for your website when you access to your site: Click “Yes” for “offline” and “No” for “online”</span></li>
<li><span style="font-size: medium;">Admin Email: Enter your valid email address you want to use for your site</span></li>
<li><span style="font-size: medium;">Admin Username: Enter “admin” as default</span></li>
<li><span style="font-size: medium;">Admin Password: Enter your own password</span></li>
<li><span style="font-size: medium;">Confirm Admin Password: Re-type your password</span></li>
<li><span style="font-size: medium;">Click “Next” to continue Step 2</span></li>
</ul>
<br />
<span style="font-size: medium;"><br /></span>
<span style="color: red; font-size: medium;">Step 2. Database Configuration</span><br />
<br />
<ul style="text-align: left;">
<li><span style="font-size: medium;">Database Type: Select MySQLi</span></li>
<li><span style="font-size: medium;">Host Name: Enter “localhost”</span></li>
<li><span style="font-size: medium;">Username: Enter “root”</span></li>
<li><span style="font-size: medium;">Password: let it blank</span></li>
<li><span style="font-size: medium;">Database Name: enter the name of the database you created “Joomla30”</span></li>
<li><span style="font-size: medium;">Table Prefix: let it generate automatically</span></li>
<li><span style="font-size: medium;">Old Database Process: Click “Backup” to backup tables from former Joomla! installation, or “Remove” to delete these tables</span></li>
<li><span style="font-size: medium;">Click “Next” to continue Step 3</span></li>
</ul>
<br />
<span style="font-size: medium;"><br /></span>
<span style="font-size: medium;"><span style="color: red;">Step 3. Overview</span> </span><br />
<br />
<ul style="text-align: left;">
<li><span style="font-size: medium;">Finalization: You can choose installing sample data or not, by clicking on corresponding selection.</span></li>
<li><span style="font-size: medium;">Overview: This step is to review all information you configured in step 1. After checking, you click “Install”.</span></li>
<li><span style="font-size: medium;">When installation finishes, you just need to click the button “Remove installation folder” button to complete the installation process. After that, you can either click on “Site” to see your newly created or “Administrator” to access the administration area.</span></li>
</ul>
<br />
<span style="font-size: medium;"><br /></span>
<span style="font-size: medium;">Now you have installed your Joomla! site successfully! </span></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-49774903829929811072014-10-05T03:17:00.001+05:302014-12-09T13:17:29.388+05:30what is joomla?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<!--
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/java-how-to-use-jframe-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use JFrame in java?" type="button" value="<<" />
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/10/how-to-install-joomla.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="how to install joomla?" type="button" value=">>" />
<br />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<b><span style="color: red;">ABOUT JOOMLA: </span></b><br />
<br />
<div style="text-align: justify;">
<b>Joomla</b> was released on September 22, 2005. It is one of the most popular free content management systems (CMS) in the world that allows you to easily create and manage a dynamic website. It has an interface to control all the features and functionality this powerful CMS possesses. Furthermore, there are hundreds of free extensions written for Joomla that allows users to extend its functionality and customize it to their own objectives.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
It is built on a model–view–controller web application framework that can be used independently of the CMS. <b>Joomla</b> is written in PHP, uses object-oriented programming (OOP) techniques (since version 1.5) and software design patterns. stores data in a MySQL, MS SQL (since version 2.5), or PostgreSQL (since version 3.0) database, and includes features such as page caching, RSS feeds, printable versions of pages, news flashes, blogs, polls, search, and support for language internationalization.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
As of 2013, Joomla has been downloaded over 50 million times. Over 7,700 free and commercial extensions are available from the official Joomla! Extension Directory, and more are available from other sources.</div>
<br />
<b><span style="color: red;">JOOMLA VERSION:</span></b><br />
<br />
<br />
<table align="center" border="1" cellpadding="5" cellspacing="0">
<tbody>
<tr>
<th><span style="color: red; font-weight: normal;">VERSION</span></th>
<th><span style="color: red; font-weight: normal;">RELEASED DATE</span></th>
</tr>
<tr>
<td>1.0</td>
<td>September 22, 2005</td>
</tr>
<tr>
<td>1.5</td>
<td>January 22, 2008</td>
</tr>
<tr>
<td>1.6</td>
<td>January 10, 2011</td>
</tr>
<tr>
<td>1.7</td>
<td>July 19, 2011</td>
</tr>
<tr>
<td>2.5</td>
<td>January 24, 2012</td>
</tr>
<tr>
<td>3.0</td>
<td>September 27, 2012</td>
</tr>
<tr>
<td>3.1</td>
<td>April 24, 2013</td>
</tr>
<tr>
<td>3.2</td>
<td>November 6, 2013</td>
</tr>
<tr>
<td>3.3</td>
<td>April 30, 2014</td>
</tr>
<tr>
<td>3.4</td>
<td>September 2014</td>
</tr>
</tbody></table>
<br />
<br />
Take a look of joomla 3:
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcsC9oI-FZ5hWZenB-3bV6_qyk_v39xuEhGrZK0F0AxTROr9RlETaEcGPi69k7Zt50WNxuNfcXdjWPp4HYzsnY3vNommLQavdM-3W1LXBO3AvJsbSTGNYh2W4MQWYsTsweaOQyU4PF9-0r/s1600/joomla3.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="joomla installation" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcsC9oI-FZ5hWZenB-3bV6_qyk_v39xuEhGrZK0F0AxTROr9RlETaEcGPi69k7Zt50WNxuNfcXdjWPp4HYzsnY3vNommLQavdM-3W1LXBO3AvJsbSTGNYh2W4MQWYsTsweaOQyU4PF9-0r/s1600/joomla3.gif" height="452" width="640" /></a></div>
</div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-88950545041205567902014-09-28T03:16:00.002+05:302014-12-09T13:18:51.687+05:30how to show Order derivation using program in java?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<div style="text-align: justify;">
If a Sub Class extends a Super Class then Super class Default constructor would be call first and then Sub class Default constructor will be called. If sub class calling its own Parameterized constructor and if super keyword is not available (i:e; super(parameter)) in Parameterized constructor of sub class then Default constructor of Super class call first and then Sub class parameterized constructor will be call.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: red;"><b>NOTE:-</b></span></div>
<div style="text-align: justify;">
To call Super class parameterized constructor from sub class parameterized constructor, must use ‘super(parameter)’ statement in Parameterized constructor of sub class, otherwise it will call super class Default constructor first and then call sub class parameterized constructor. </div>
<br />
<br />
Ex:
<br />
<div style="text-align: center;">
<span style="font-size: large;"><b>SuperClass.java</b></span> </div>
<br />
<pre class="java" name="code">public class SuperClass
{
private String s="string of superclass";
publicSuperClass()
{
System.out.println("Super class Default Constructor");
}
publicSuperClass(String s)
{
this.s=s;
System.out.println("Super class parameterized Constructor");
}
} // Close of class Super class
</pre>
<div style="text-align: center;">
<span style="font-size: large;"><b>SubClass.java</b></span> </div>
<pre class="java" name="code">class SubClass extends SuperClass
{
String sub="string of subclass";
SubClass()
{
System.out.println("Sub class Default Constructor");
}
SubClass(String sub)
{
super("Avnish");
this.sub=sub;
System.out.println("Sub class parameterized Constructor");
}
public static void main(String[] arg)
{
SubClasssubobj=new SubClass();
newSubClass("Avnishalok");
}
}
</pre>
<br />
<span style="color: red;"><b>Output:</b></span><br />
<b>Super class Default Constructor</b><br />
<b>Sub class Default Constructor</b><br />
<b>Super class parameterized Constructor</b><br />
<b>Sub class parameterized Constructor</b><br />
<b><br /></b>
<b><br /></b>
<span style="color: red;"><b>If the statement super("Avnish"); is omitted then the output:</b></span><br />
<b>Super class Default Constructor</b><br />
<b>Sub class Default Constructor</b><br />
<b>Super class Default Constructor</b><br />
<b>Sub class parameterized Constructor</b></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-31323851504709701612014-09-26T06:09:00.001+05:302014-12-09T13:02:23.311+05:30how to create a textfield that holds only upper case characters in java?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/java-how-to-use-jframe-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use JFrame in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-use-list-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use list in java ?" type="button" value=">>" />
<br />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
The following piece of code will create a field that holds only upper case characters. It will work even if text is pasted into from the clipboard.</div>
<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">UpperCaseField.java</span></b></div>
<br />
<pre class="java" name="code">import javax.swing.*;
import javax.swing.text.Document;
import javax.swing.text.PlainDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
public class UpperCaseField extends JTextField {
public UpperCaseField(int cols) {
super(cols);
}
protected Document createDefaultModel() {
return new UpperCaseDocument();
}
static class UpperCaseDocument extends PlainDocument {
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
if (str == null) {
return;
}
char[] upper = str.toCharArray();
for (int i = 0; i < upper.length; i++) {
upper[i] = Character.toUpperCase(upper[i]);
}
super.insertString(offs, new String(upper), a);
}
}
}
</pre>
<br />
<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">main.java</span></b></div>
<br />
<br />
<pre class="java" name="code">import javax.swing.*;
import java.awt.*;
class main extends JFrame
{
UpperCaseField ucf;
Container c;
main()
{
c=getContentPane();
c.setLayout(null);
setTitle("Text");
setBounds(120,100,500,350);
setVisible(true);
setResizable(false);
JLabel lbl=new JLabel("Upper Case:");
lbl.setBounds(10,10,100,30);
c.add(lbl);
ucf=new UpperCaseField(30);
ucf.setBounds(120,10,350,30);
c.add(ucf);
setContentPane(c);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] arg)
{
new main();
}
}
</pre>
<div>
<br />
<br />
OUTPUT:-
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWotnGcJqQTKLFEB1K55BSD8LKJrzUO8PQSQGmmfKEkePNzNOPcDhLjh-gs7O341Dbme0qYh0MzvOrXrKL1sHfaPw0YbddTeQ252TOimCxLxM-hQtfNCPkPHGt5EbXBeAFT1hGztbTSqwf/s1600/letter.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWotnGcJqQTKLFEB1K55BSD8LKJrzUO8PQSQGmmfKEkePNzNOPcDhLjh-gs7O341Dbme0qYh0MzvOrXrKL1sHfaPw0YbddTeQ252TOimCxLxM-hQtfNCPkPHGt5EbXBeAFT1hGztbTSqwf/s1600/letter.png" height="460" width="640" /></a></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-64880221528238685832014-09-18T22:12:00.002+05:302014-09-18T22:15:51.392+05:30<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDaSEx4uhrLcHK37vvxSqVhBMHZ76mpFWGDm5k7hhJXEJz36SVa6ViCJ65xg6SasAmxNpY7ZHbu3UGs_jePbk3edwhUtpJwFgNNzxlLNcCU-KwKda6kt8dkI1wHQdpBhSEz3THPba6Lwh3/s1600/Coming-Soon.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDaSEx4uhrLcHK37vvxSqVhBMHZ76mpFWGDm5k7hhJXEJz36SVa6ViCJ65xg6SasAmxNpY7ZHbu3UGs_jePbk3edwhUtpJwFgNNzxlLNcCU-KwKda6kt8dkI1wHQdpBhSEz3THPba6Lwh3/s1600/Coming-Soon.png" height="137" width="320" /></a></div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-38454013765684271602014-05-22T21:19:00.000+05:302014-12-09T13:02:49.861+05:30how to use list in java ?<div dir="ltr" style="text-align: left;" trbidi="on">
<!-- google add -->
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- cshotopics_main_Blog1_300x250_as -->
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/09/how-to-automatically-convert-text-into.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="how to create a textfield that holds only upper case characters in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-edit-and-display-combobox-item.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to edit and display combobox item in java?" type="button" value=">>" />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<br />
A JList presents the user with a group of items, displayed in one or more columns, to choose from. Lists can have many items, so they are often put in scroll panes.<br />
<br />
In addition to lists, the following Swing components present multiple selectable items to the user: combo boxes, menus, tables, and groups of check boxes or radio buttons. To display hierarchical data, use a tree.
</div>
<br />
<br />
<br />
<div style="text-align: center;">
<span style="font-size: large;"><b>ListTest.java</b></span></div>
<br />
<pre class="java" name="code">import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import javax.swing.ButtonGroup;
import javax.swing.JList;
import javax.swing.JRadioButton;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.ListSelectionEvent;
/*
This program demonstrates a simple fixed list of strings.
*/
public class ListTest
{
public static void main(String[] args)
{
JFrame frame = new ListFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
/**
This frame contains a word list and a label that shows a
sentence made up from the chosen words. Note that you can
select multiple words with Ctrl+click and Shift+click.
*/
class ListFrame extends JFrame
{
public ListFrame()
{
setTitle("ListTest");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
String[] words =
{
"quick","brown","hungry","wild","silent",
"huge","private","abstract","static","final"
};
wordList = new JList(words); // To create List box.
/* Alternatively, you can use an anonymous array:
JList wordList = new JList(new String[] {"quick", "brown", "hungry", "wild","silent","huge","private","abstract","static","final" });
*/
/*
By default, the list component displays eight items; use the setVisibleRowCount method to change that value:
wordList.setVisibleRowCount(4); // display 4 items
You can also restrict the user to a more limited selection mode with the setSelectionMode method:
wordList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// select one item at a time
wordList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
// select one item or one range of items
*/
wordList.setVisibleRowCount(4);
//List boxes do not scroll automatically. To make a list box scroll, you must insert it into a scroll pane:
JScrollPane scrollPane = new JScrollPane(wordList);
listPanel = new JPanel();
listPanel.add(scrollPane);
wordList.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent event)
{
/*
The getSelectedValues method returns an array of objects containing all selected items. Cast each array element to a string.
Object[] values = list.getSelectedValues(); //returns the selected values or an empty array if the selection is empty.
for (Object value : values)
do something with (String) value;
.......................................................
If your list does not allow multiple selections, you can call the convenience method getSelectedValue. It returns the first selected value (which you know to be the only value if multiple selections are disallowed).
String value = (String) list.getSelectedValue();
*/
Object[] values = wordList.getSelectedValues();
StringBuilder text = new StringBuilder(prefix);
// for (int i = 0; i < values.length; i++)
for (Object value : values)
{
//String word = values[i];
String word = (String) value;
text.append(word);
text.append(" ");
}
text.append(suffix);
label.setText(text.toString());
}
});
buttonPanel = new JPanel();
group = new ButtonGroup();
/*
You can set the layout orientation to one of three values:
JList.VERTICAL (the default): arrange all items vertically
JList.VERTICAL_WRAP: start new columns if there are more items than the visible row count
JList.HORIZONTAL_WRAP: start new columns if there are more items than the visible row count, but fill them horizontally.
*/
makeButton("Vertical", JList.VERTICAL);
makeButton("Vertical Wrap", JList.VERTICAL_WRAP);
makeButton("Horizontal Wrap", JList.HORIZONTAL_WRAP);
add(listPanel, BorderLayout.NORTH);
label = new JLabel(prefix + suffix);
add(label, BorderLayout.CENTER);
add(buttonPanel, BorderLayout.SOUTH);
}
/**
Makes a radio button to set the layout orientation.
@param label the button label
@param orientation the orientation for the list
*/
private void makeButton(String label, final int orientation)
{
JRadioButton button = new JRadioButton(label);
buttonPanel.add(button);
if (group.getButtonCount() == 0) button.setSelected(true);
group.add(button);
button.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent event)
{
wordList.setLayoutOrientation(orientation);
listPanel.revalidate();
}
});
}
private static final int DEFAULT_WIDTH = 400;
private static final int DEFAULT_HEIGHT = 300;
private JPanel listPanel;
private JList wordList;
private JLabel label;
private JPanel buttonPanel;
private ButtonGroup group;
private String prefix = "The ";
private String suffix = "fox jumps over the lazy dog.";
}
/*
List components do not react to double clicks from a mouse. As envisioned by the designers of Swing, you use a list to select an item, and then you click a button to make something happen. However, some user interfaces allow a user to double-click on a list item as a shortcut for item selection and acceptance of a default action. If you want to implement this behavior, you have to add a mouse listener to the list box, then trap the mouse event as follows:
public void mouseClicked(MouseEvent evt)
{
if (evt.getClickCount() == 2)
{
JList source = (JList) evt.getSource();
Object[] selection = source.getSelectedValues();
doAction(selection);
}
}
*/
</pre>
OUTPUT:-<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2GvetMpZl0AskXU0PUO5X-RN4UETtTToH8Npeg1MeYackeya1DaEkTV_QFW1ZTtrIM6ymPCmFEoDBMvH_6Ai4feh6ihFfPEQUJm5gVUGDTpQcQspP3dgFhDRXxAXNVuLvd6EqXEvpVbor/s1600/jlist.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2GvetMpZl0AskXU0PUO5X-RN4UETtTToH8Npeg1MeYackeya1DaEkTV_QFW1ZTtrIM6ymPCmFEoDBMvH_6Ai4feh6ihFfPEQUJm5gVUGDTpQcQspP3dgFhDRXxAXNVuLvd6EqXEvpVbor/s1600/jlist.png" height="432" width="640" /></a></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-22113880645092137462014-05-22T20:59:00.003+05:302014-12-09T13:03:26.273+05:30how to edit and display combobox item in java?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-use-list-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use list in java ?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/normal-0-false-false-false-en-us-x-none.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use combobox in java?" type="button" value=">>" />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
A component that combines a button or editable <span class="uvm979uz67ol" id="uvm979uz67ol_10" style="font-weight: bold; height: 12px;">field</span> and a drop-down list.
The user can select a value from the drop-down list, which appears at the
user's request. If you make the combo box editable, then the combo box
includes an editable field into which the user can type a value.
</div>
<br />
<br />
<div style="text-align: center;">
<span style="font-size: large;"><b>comboboxd.java</b></span></div>
<br />
<pre class="java" name="code">package packge;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class comboboxd extends JFrame implements ItemListener,ActionListener
{
JComboBox box,box1;
JLabel lbl;
JButton b1,b2,b3;
public comboboxd()
{
Container c=getContentPane();
c.setLayout(new FlowLayout());
c.setBackground(Color.cyan);
box=new JComboBox();
box1=new JComboBox();
lbl=new JLabel();
lbl.setFont(new Font("Arial black",Font.BOLD,12));
b1=new JButton("Set");
b2=new JButton("Show Index");
b3=new JButton("Item at Index");
box.addItem("India");
box.addItem("America");
box.addItem("Germany");
box.addItem("Japan");
box.addItem("France");
box.setEditable(true); // To edit in ComboBox
box1.addItem("Africa");
box1.addItem("America");
box.addItemListener(this);
box1.addItemListener(this);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
c.add(box);
c.add(box1);
c.add(b1);
c.add(b2);
c.add(b3);
c.add(lbl);
}
public void itemStateChanged(ItemEvent ie)
{
/*
itemStateChanged method called twice because it runs when item is selected or deselected.
above problem is resolved using getStateChange() method.
getStateChange() method returns 1 for selected item and 2 for
*/
//deselected item.
int select=ie.getStateChange();
if(select==1)
{
//if box1 item is clicked then perform the logic
if(ie.getSource()==box)
{
String str=String.valueOf(box.getSelectedItem());
lbl.setText("You selected:" +str+" of ComboBox1");
}
//if box2 item is clicked then perform the logic
if(ie.getSource()==box1)
{
/*hello will print twice because itemStateChanged() method
called twice. one for item selected and second for item
deselected.
*/
System.out.println("hello");
String str=String.valueOf(box.getSelectedItem());
lbl.setText("You selected:" +str+" of ComboBox2");
}
}//close of if(select==1)
}//close of itemStateChanged(ItemEvent ie)
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
box.addItem(box.getSelectedItem());
if(ae.getSource()==b2)
lbl.setText("Your selected Item index: " +String.valueOf(box.getSelectedIndex()));
if(ae.getSource()==b3)
lbl.setText("Item at Index: " +String.valueOf(box.getSelectedIndex()) +" is "+String.valueOf(box.getItemAt(box.getSelectedIndex())));
}
public static void main(String args[])
{
comboboxd demo=new comboboxd();
demo.setTitle("combo Box");
demo.setSize(850,300);
demo.setVisible(true);
demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
</pre>
<br />
OUTPUT:-<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRZ0kgBqoKtYuKjFcpeP7mYDRNjLv5TyKUjj1O3NZqM-WqTPlyzmOrbGOucoQkc-XaSe5lPyUADBrBElslml-PfkJka_lUn-jxkF_IJ-gie-CVprg44_2JYkc6kVgDj7j4_6lHma1v4wL-/s1600/combobox_edit_disp.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRZ0kgBqoKtYuKjFcpeP7mYDRNjLv5TyKUjj1O3NZqM-WqTPlyzmOrbGOucoQkc-XaSe5lPyUADBrBElslml-PfkJka_lUn-jxkF_IJ-gie-CVprg44_2JYkc6kVgDj7j4_6lHma1v4wL-/s1600/combobox_edit_disp.png" height="230" width="640" /></a></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-25422369877032586982014-05-22T20:33:00.001+05:302014-12-09T13:04:05.750+05:30how to use combobox in java? <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-edit-and-display-combobox-item.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to edit and display combobox item in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-use-checkbox-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use checkbox in java?" type="button" value=">>" />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<br />
A component that combines a button or editable field and a drop-down list. The user can select a value from the drop-down list, which appears at the user's request. If you make the combo box editable, then the combo box includes an editable field into which the user can type a value.
</div>
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">combotest1.java</span></b></div>
<br />
<pre class="java" name="code">import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class combotest1 extends JFrame implements ComponentListener
{
JComboBox box;
combotest1()
{
Container c=this.getContentPane();
c.setLayout(new FlowLayout());
box=new JComboBox();
box.setToolTipText("Combo Box");
box.addItem("Apple");
box.addItem("Mango");
box.addItem("Orange");
box.addItem("Banana");
box.addItem("Guava");
box.setBounds(60,20,80,20);
this.addComponentListener(this);
c.add(box);
setResizable(false); //not resizable
setLocation(400,250);
} //close of default constructor
public void componentResized(ComponentEvent e) { }
public void componentMoved(ComponentEvent e)
{
this.setLocation(400,250);
}
public void componentShown(ComponentEvent e) { }
public void componentHidden(ComponentEvent e) { }
public static void main(String args[]){
combotest1 obj=new combotest1();
obj.setVisible(true);
obj.setSize(200,150);
obj.setTitle("Combo Box");
obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
</pre>
<br />
<div style="font-size: 18px; font: Verdana, Arial, Helvetica, sans-serif; opacity: 0.7; text-shadow: 0px 1px 1px #4d4d4d;">
OUTPUT:-</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKFF6k8kCr71REQzuLp0nrsjjEmU7ci0JpwpYoOSfvAISlS-20MA5SLKAnCH-LG0SWG08Fo3cHP377X9jDczgDVKxu7QxU-GaEo7gN47xHV8M2ZL8Pr3YTiTyiaPoxIj6t6cekleysYuPf/s1600/combobox.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKFF6k8kCr71REQzuLp0nrsjjEmU7ci0JpwpYoOSfvAISlS-20MA5SLKAnCH-LG0SWG08Fo3cHP377X9jDczgDVKxu7QxU-GaEo7gN47xHV8M2ZL8Pr3YTiTyiaPoxIj6t6cekleysYuPf/s1600/combobox.png" height="468" width="640" /></a></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-19880531051549651702014-05-22T20:17:00.000+05:302014-12-09T13:04:33.067+05:30how to use checkbox in java?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/normal-0-false-false-false-en-us-x-none.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use combobox in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-change-width-of-textfield.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to change the width of a textfield dynamically in java?" type="button" value=">>" />
<br />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
A check box provides a way to make a single on/off choice. It consists of a tiny box and a label. The box typically holds a little “x” (or some other indication that it is set) or is empty, depending on whether that item was selected. You’ll normally create a JCheckBox using a constructor that takes the label as an argument. You can get and set the state, and also get and set the label if you want to read or change it after the JCheckBox has been created. Whenever a JCheckBox is set or cleared, an event occurs, which you can capture the same way you do a button by using an ActionListener.<br />
<br />
The following example uses a JTextArea to enumerate all the check boxes that have been checked. The trace( ) method sends the name of the selected JCheckBox and its current state to the JTextArea using append( ), so you’ll see a cumulative list of the checkboxes that were selected and what their state is.
</div>
<br />
<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">CheckBoxes.java</span></b></div>
<br />
<pre class="java" name="code">import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class CheckBoxes extends JFrame {
private JTextArea t = new JTextArea(6, 15);
private JCheckBox
cb1 = new JCheckBox("Check Box 1"),
cb2 = new JCheckBox("Check Box 2"),
cb3 = new JCheckBox("Check Box 3");
CheckBoxes() {
super("CheckBox Demo");
cb1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
trace("1", cb1);
}
});
cb2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
trace("2", cb2);
}
});
cb3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
trace("3", cb3);
}
});
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
cp.add(new JScrollPane(t));
cp.add(cb1);
cp.add(cb2);
cp.add(cb3);
}
private void trace(String b, JCheckBox cb) {
if(cb.isSelected())
t.append("Box " + b + " Set\n");
else
t.append("Box " + b + " Cleared\n");
}
public static void main(String[] args) {
CheckBoxes chkbox= new CheckBoxes();
//chkbox.setSize(300,300);
chkbox.pack();
chkbox.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
chkbox.setVisible(true);
}
}
</pre>
<br />
<div style="font-size: 18px; font: Verdana, Arial, Helvetica, sans-serif; opacity: 0.7; text-shadow: 0px 1px 1px #4d4d4d;">
OUTPUT:-
</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9i7mz42VWpX53NAtNQ436FIWsHi5wBzbBBHKrFnwyKHJywH2d8xRIJzvfAhtX76inh_pZt41-9srXL-0MKV_Urk75oqSXbcf7Y4m_9u3bZyKLIHgq0szOJgZaWXY8qVgaJ6QwX2-9LWET/s1600/checkbox.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9i7mz42VWpX53NAtNQ436FIWsHi5wBzbBBHKrFnwyKHJywH2d8xRIJzvfAhtX76inh_pZt41-9srXL-0MKV_Urk75oqSXbcf7Y4m_9u3bZyKLIHgq0szOJgZaWXY8qVgaJ6QwX2-9LWET/s1600/checkbox.png" height="262" width="640" /></a></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-76589552737439217182014-05-21T15:29:00.002+05:302014-12-09T13:05:05.085+05:30how to change the width of a textfield dynamically in java? <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-use-checkbox-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use checkbox in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-display-textfield-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use textfield in java?" type="button" value=">>" />
<br />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<span style="color: red;">JTextField textField = new JTextField("Default input", 10);</span><br />
<span style="color: red;">textField.setColumns(20);</span><br />
<span style="color: red;">panel.validate();</span><br />
<br />
After changing the size of a text box with the setColumns method, you need to call the validate method of the surrounding container. The validate method recomputes the size and layout of all components in a container. After you use the validate method, the layout manager repaints the container, and the changed size of the text field will be visible.
<br />
<br />
In general, you want to let the user add text (or edit the existing text) in a text field. Quite often these text fields start out blank. To make a blank text field, just leave out the string as a parameter for the JTextField constructor:
<br />
<br />
<span style="color: red;">JTextField textField = new JTextField(20);</span><br />
<br />
You can change the contents of the text field at any time by using the setText method from the TextComponent parent class. For example:<br />
<br />
<span style="color: red;">textField.setText("Hello!");</span><br />
<br />
You can find out what the user typed by calling the getText method. This method returns the exact text that the user typed. To trim any extraneous leading and trailing spaces from the data in a text field, apply the trim method to the return value of getText:<br />
<br />
<span style="color: red;">String text = textField.getText().trim();</span><br />
<br />
To change the font in which the user text appears, use the setFont method.
</div>
<br />
<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">Jtextfld.java</span></b></div>
<br />
<pre class="java" name="code">import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Jtextfld extends JFrame {
private JPanel contentPane;
private JTextField textField;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Jtextfld frame = new Jtextfld();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Jtextfld() {
setAlwaysOnTop(true);
setResizable(false);
setTitle("TextFiled ");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 425, 256);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel(" Change TextFiled width");
lblNewLabel.setBounds(94, 11, 197, 38);
contentPane.add(lblNewLabel);
textField = new JTextField(); //new JTextField(10); or textField.setColumns(10); or textField.setSize(int width,int height);
textField.setBounds(144, 86, 86, 20);
contentPane.add(textField);
textField.setColumns(10);
JButton btnNewButton = new JButton("Original width");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
textField.setSize(86, 20);
}
});
btnNewButton.setBounds(70, 171, 117, 23);
contentPane.add(btnNewButton);
JButton btnChangeWidth = new JButton("Change width");
btnChangeWidth.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
textField.setSize(140, 20);
}
});
btnChangeWidth.setBounds(246, 171, 117, 23);
contentPane.add(btnChangeWidth);
}
}
</pre>
<br />
<br />
<div style="font-size: 18px; font: Verdana, Arial, Helvetica, sans-serif; opacity: 0.7; text-shadow: 0px 1px 1px #4d4d4d;">
OUTPUT:-
</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNwMYzXd-6l5AZAnX2rD__vm4OPcCzqRHjXraDUgrYYsNx9yvKJ8zmX9fwtPAKJAbIm4O3jAXXTcaeF_2KvacEuCa9yQnz_faI4WchTvL_PXqfQCJPtlD-4_aMCfrJ53N6gy9TsQAqNFpV/s1600/change_width.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNwMYzXd-6l5AZAnX2rD__vm4OPcCzqRHjXraDUgrYYsNx9yvKJ8zmX9fwtPAKJAbIm4O3jAXXTcaeF_2KvacEuCa9yQnz_faI4WchTvL_PXqfQCJPtlD-4_aMCfrJ53N6gy9TsQAqNFpV/s1600/change_width.png" height="376" width="640" /></a></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-27076979156523548612014-05-21T15:16:00.000+05:302014-12-09T13:05:38.403+05:30how to use textfield in java? <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-change-width-of-textfield.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to change the width of a textfield dynamically in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-test-buttons-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use buttons in java?" type="button" value=">>" />
<br />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<span style="color: red;">public class JTextField extends JTextComponent implements SwingConstants</span><br />
<br />
JTextField is a lightweight component that allows the editing of a single line of text. JTextField is intended to be source-compatible with java.awt.TextField where it is reasonable to do so. This component has capabilities not found in the java.awt.TextField class.<br />
<br />
JTextField has a method to establish the string used as the command string for the action event that gets fired. The java.awt.TextField used the text of the field as the command string for the ActionEvent. JTextField will use the command string set with the setActionCommand method if not null, otherwise it will use the text of the field as a compatibility with java.awt.TextField.<br />
<br />
The method setEchoChar and getEchoChar are not provided directly to avoid a new implementation of a pluggable look-and-feel inadvertently exposing password characters. To provide password-like services a separate class JPasswordField extends JTextField to provide this service with an independently pluggable look-and-feel.<br />
<br />
The java.awt.TextField could be monitored for changes by adding a TextListener for TextEvent's. In the JTextComponent based components, changes are broadcasted from the model via a DocumentEvent to DocumentListeners. The DocumentEvent gives the location of the change and the kind of change if desired. The code fragment might look something like:<br />
<br />
<br />
<span style="color: red;"> DocumentListener myListener = ??;</span><br />
<span style="color: red;"> JTextField myArea = ??;</span><br />
<span style="color: red;"> myArea.getDocument().addDocumentListener(myListener);</span><br />
<br />
The horizontal alignment of JTextField can be set to be left justified, leading justified, centered, right justified or trailing justified. Right/trailing justification is useful if the required size of the field text is smaller than the size allocated to it. This is determined by the setHorizontalAlignment and getHorizontalAlignment methods. The default is to be leading justified.<br />
<br />
How the text field consumes VK_ENTER events depends on whether the text field has any action listeners. If so, then VK_ENTER results in the listeners getting an ActionEvent, and the VK_ENTER event is consumed. This is compatible with how AWT text fields handle VK_ENTER events. If the text field has no action listeners, then as of v 1.3 the VK_ENTER event is not consumed. Instead, the bindings of ancestor components are processed, which enables the default button feature of JFC/Swing to work.
</div>
<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;"> JTextField.java</span></b></div>
<br />
<br />
<pre class="java" name="code">import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
public class JTextField extends JFrame {
private JPanel contentPane;
private javax.swing.JTextField textField;
private javax.swing.JTextField textField_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
JTextField frame = new JTextField();
frame.setVisible(true);
}
/**
* Create the frame.
*/
public JTextField() {
setTitle("JTextField example");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
setContentPane(contentPane);
contentPane.setLayout(null);
contentPane.setBackground(Color.BLUE);
textField = new javax.swing.JTextField();
textField.setBounds(228, 43, 121, 20);
contentPane.add(textField);
textField.setColumns(10);
JLabel lblEnterYourName = new JLabel("Enter your Name");
lblEnterYourName.setBounds(40, 40, 102, 27);
contentPane.add(lblEnterYourName);
JLabel lblEnterAddress = new JLabel("Enter Address");
lblEnterAddress.setBounds(40, 102, 86, 27);
contentPane.add(lblEnterAddress);
textField_1 = new javax.swing.JTextField();
textField_1.setBounds(228, 105, 121, 20);
contentPane.add(textField_1);
textField_1.setColumns(10);
final JButton btnSubmit = new JButton("Test");
btnSubmit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String txtfld1=textField.getText();
String txtfld2=textField_1.getText();
if(arg0.getSource()==btnSubmit)
JOptionPane.showMessageDialog(JTextField.this,"Your name is "+txtfld1+" and address is "+txtfld2,"MessageBox",1);
}
});
btnSubmit.setBounds(179, 198, 75, 23);
contentPane.add(btnSubmit);
}
}
</pre>
<br />
<br />
<div style="font-size: 18px; font: Verdana, Arial, Helvetica, sans-serif; opacity: 0.7; text-shadow: 0px 1px 1px #4d4d4d;">
OUTPUT:-
</div>
<br />
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSYc_vEV4hLovvqduU50ChOXu57oF-yj4h39TGQxo_E902OsDNfPSyF5LsZvyVoPS1lZFAfWgOjr_9syXPiuKtLU0Ww_e2if4jT7vLeiTpavW0Bagss01oW1PxmY8lA71LCS4z_3wLp2aO/s1600/display_textfield.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSYc_vEV4hLovvqduU50ChOXu57oF-yj4h39TGQxo_E902OsDNfPSyF5LsZvyVoPS1lZFAfWgOjr_9syXPiuKtLU0Ww_e2if4jT7vLeiTpavW0Bagss01oW1PxmY8lA71LCS4z_3wLp2aO/s1600/display_textfield.png" height="422" width="640" /></a></div>
<div>
</div>
<div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-77554814301556415522014-05-21T15:00:00.001+05:302014-12-09T13:06:14.112+05:30how to use buttons in java?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-display-textfield-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use textfield in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-change-shape-of-button-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to change the border of a button in java?" type="button" value=">>" />
<br />
<br />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
<span style="color: red;">public class JButton extends AbstractButton implements Accessible</span><br />
<span style="color: blue;"><br /></span>
The class JButton is an implementation of a push button. This component has a label and generates an event when pressed. It can have Image also.<br />
<br />
Buttons can be configured, and to some degree controlled, by Actions. Using an Action with a button has many benefits beyond directly configuring a button.
</div>
<br />
<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;"> DisplyButton.java</span></b></div>
<br />
<pre class="java" name="code">import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class DisplyButton {
private JButton b1 = new JButton("Button 1"),b2 = new JButton("Button 2");
private JTextField txt = new JTextField(10);
class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
//String name = ((JButton)e.getSource()).getText(); //Return Button name as type String.
String arg = e.getActionCommand(); //getActionCommand return Button name as String type.
//if(e.getSource()==b1 || e.getSource()==b2)
// txt.setText(arg);
//if(arg.equals("Button 1") || arg.equalsIgnoreCase("button 2"))
// txt.setText(arg);
txt.setText(arg);
}
} //close of class ButtonListener
private ButtonListener bl = new ButtonListener();
DisplyButton() {
JFrame jf=new JFrame("JButton");
b1.addActionListener(bl);
b2.addActionListener(bl);
Container cp = jf.getContentPane();
cp.setLayout(new BorderLayout());
JPanel jpForBtn=new JPanel();
jpForBtn.setLayout(new FlowLayout(FlowLayout.RIGHT)); //FlowLayout.LEFT, FlowLayout.CENTER
jpForBtn.add(b1);
jpForBtn.add(b2);
txt.setBackground(Color.WHITE);
cp.add(jpForBtn,BorderLayout.SOUTH); //add JPanel on Bottom right corner of frame
cp.add(txt,BorderLayout.NORTH); //add JTextField on top of frame
jf.setSize(600,400);
jf.setResizable(false);
jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
jf.setVisible(true);
} //close of constructor
public static void main(String[] args) {
DisplyButton dispbtn=new DisplyButton();
}
} //close of class DisplyButton
</pre>
<br />
<br />
<br />
<div style="font-size: 18px; font: Verdana, Arial, Helvetica, sans-serif; opacity: 0.7; text-shadow: 0px 1px 1px #4d4d4d;">
OUTPUT:-
</div>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiRKBt27Q0yDwcSiu7WN9qJ7ik5BY4-vrqc1-L3W1GZGzTLbHLVyE5BDk2-TvrhU-R01zvzS6lv2CA6ndsSD2VBYa70l8cxNKKVuQ6lduBzf9kqKT8K1SU28n-8SMVw4LdwTSoNQia5U6R/s1600/addbtn.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiRKBt27Q0yDwcSiu7WN9qJ7ik5BY4-vrqc1-L3W1GZGzTLbHLVyE5BDk2-TvrhU-R01zvzS6lv2CA6ndsSD2VBYa70l8cxNKKVuQ6lduBzf9kqKT8K1SU28n-8SMVw4LdwTSoNQia5U6R/s1600/addbtn.png" height="378" width="640" /></a></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-78410273348494147862014-05-21T14:50:00.000+05:302014-12-09T13:06:49.141+05:30how to change the border of a button in java?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-test-buttons-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to use buttons in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-display-dialog-box-by-clicking.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="How to use dialog box in java?" type="button" value=">>" />
<br />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
There is a way to change the default button border of swing's JButton to some others by implementing <b>Border</b> and overriding its method. Below is the code to do so.
</div>
<br />
<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">ChangeButtonShape.java</span></b></div>
<br />
<br />
<pre class="java" name="code">import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;
import java.awt.event.*;
import javax.swing.border.*;
public class ChangeButtonShape {
public static void main(String[] args) {
try {
String laf = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(laf); //throws UnsupportedLookAndFeelException
}
catch (Exception e) {
e.printStackTrace();
}
//if the look and feel code is written below the JFrame object then JFrame will
//not be shown as windows look & feel. Only components will shown as windows look.
JFrame frame = new JFrame();
frame.getContentPane().setLayout(null);
JLabel l=new JLabel("Name");
final JTextField text=new JTextField(20);
JButton button = new JButton("Go");
//button.setBackground(Color.lightGray);
l.setBounds(10,10,100,20);
text.setBounds(100,10,180,20);
button.setBounds(10,40,50,20);
button.setBorder(new RoundedBorder(10));
frame.add(l);
frame.add(text);
frame.add(button);
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String st=text.getText();
JOptionPane.showMessageDialog(null,"Hello "+st);
}
});
frame.setSize(300,150);
frame.setVisible(true);
}
}
class RoundedBorder implements Border {
int radius;
RoundedBorder(int radius) {
this.radius = radius;
}
public Insets getBorderInsets(Component c) {
return new Insets(this.radius+1, this.radius+1, this.radius+2, this.radius);
}
public boolean isBorderOpaque() {
return true;
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
g.drawRoundRect(x,y,width-1,height-1,radius,radius);
}
}
</pre>
<br />
<br />
<br />
<div style="font-size: 18px; font: Verdana, Arial, Helvetica, sans-serif; opacity: 0.7; text-shadow: 0px 1px 1px #4d4d4d;">
OUTPUT:-
</div>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih0DrrJHxZHbgBFMtgK1yewc-pChVuDSzHEBSLewge8CIjhwwM11ukCQE9D0CXv1KrKpR6P-TKKJeZGi2qUZ-IZ6fzn_jHnkwg1z5iiiBPPqVYEl_QkJJnaUVkw8Ea6s93tOH2jOEoCLcR/s1600/changed_shape_btn.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih0DrrJHxZHbgBFMtgK1yewc-pChVuDSzHEBSLewge8CIjhwwM11ukCQE9D0CXv1KrKpR6P-TKKJeZGi2qUZ-IZ6fzn_jHnkwg1z5iiiBPPqVYEl_QkJJnaUVkw8Ea6s93tOH2jOEoCLcR/s1600/changed_shape_btn.png" height="450" width="640" /></a></div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0tag:blogger.com,1999:blog-245384600576074043.post-33810981734006917812014-05-21T13:59:00.001+05:302014-12-09T13:07:23.911+05:30how to use dialog box in java?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<input align="left" onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-change-shape-of-button-in-java.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 60px;" title="How to change the border of a button in java?" type="button" value="<<" />
<!--
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/02/interactive-form-design-using-css-jquery.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #0066cc; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 135px;" type="button" value="Web Designing" />
-->
<input onclick="javascript:window.location.href='http://cshotopics.blogspot.in/2014/05/how-to-apply-various-background-colors.html'" style="-moz-border-radius: 8px; -moz-transition: all 0.218s; -o-transition: all 0.218s; -webkit-border-radius: 8px; -webkit-transition: all 0.218s; background-color: #66cc00; border-radius: 8px; border: 1px solid #dcdcdc; color: white; cursor: pointer; display: inline-block; float: right; font-size: 14px; font-weight: 700; height: 30px; line-height: 30px; padding: 0 8px; text-align: center; transition: all 0.218s; width: 70px;" title="how to change background color of JPanel by clicking buttons?" type="button" value=">>" />
<br />
<br />
<br />
<div style="color: black; font-size: 16px; font: Verdana, Arial, Helvetica, sans-serif; line-height: 160%; text-shadow: 0px 1px 1px #4d4d4d;">
A Dialog window is an independent subwindow meant to carry temporary notice apart from the main Swing Application Window. Most Dialogs present an error message or warning to a user, but Dialogs can present images, directory trees, or just about anything compatible with the main Swing Application that manages them.<br />
<br />
For convenience, several Swing component classes can directly instantiate and display dialogs. To create simple, standard dialogs, you use the JOptionPane class. The ProgressMonitor class can put up a dialog that shows the progress of an operation. Two other classes, JColorChooser and JFileChooser, also supply standard dialogs. To bring up a print dialog, you can use the Printing API. To create a custom dialog, use the JDialog class directly.<br />
<br />
The code for simple dialogs can be minimal. For example, here is an informational dialog:
<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD18dGqUR4v3CEJ8wt2CxWHUAdh9WIoKPTp5QS910GMKSmOUlnS6dmRmyZ0dc80hTPAaiHKT7sH3UDlMIwJ9n2GGQFhaBGsuLuDeVtTm4TlSmQbKM214jExO5HSvd4Xn-QsHguu_VrH-V3/s1600/InformationalDialog.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD18dGqUR4v3CEJ8wt2CxWHUAdh9WIoKPTp5QS910GMKSmOUlnS6dmRmyZ0dc80hTPAaiHKT7sH3UDlMIwJ9n2GGQFhaBGsuLuDeVtTm4TlSmQbKM214jExO5HSvd4Xn-QsHguu_VrH-V3/s1600/InformationalDialog.png" /></a></div>
<br />
<br />
<br />
Here is the code that creates and shows it:
<br />
<br />
<span style="color: red;">JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green.");</span>
<br />
<br />
Below is the code to show dialog box by clicking on button:
<br />
<div style="text-align: center;">
<b><span style="font-size: large;"> Jdialog.java</span></b> </div>
<br />
<br />
<pre class="java" name="code">import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
//import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Jdialog extends JFrame {
private JPanel contentPane;
private javax.swing.JTextField textField;
private javax.swing.JTextField textField_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
Jdialog frame = new Jdialog();
frame.setVisible(true);
}
/**
* Create the frame.
*/
public Jdialog() {
setTitle("JTextField example");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
//contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
textField = new javax.swing.JTextField();
textField.setBounds(228, 43, 121, 20);
contentPane.add(textField);
textField.setColumns(10);
JLabel lblEnterYourName = new JLabel("Enter your Name");
lblEnterYourName.setBounds(40, 40, 102, 27);
contentPane.add(lblEnterYourName);
JLabel lblEnterAddress = new JLabel("Enter Address");
lblEnterAddress.setBounds(40, 102, 86, 27);
contentPane.add(lblEnterAddress);
textField_1 = new javax.swing.JTextField();
textField_1.setBounds(228, 105, 121, 20);
contentPane.add(textField_1);
textField_1.setColumns(10);
final JButton btnSubmit = new JButton("Submit");
btnSubmit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String txtfld1=textField.getText();
String txtfld2=textField_1.getText();
if(arg0.getSource()==btnSubmit)
{
//String arg = arg0.getActionCommand(); //Return clicked button name
//if (arg.equals("btnSubmit"))
JOptionPane.showMessageDialog(Jdialog.this,"Your name is "+txtfld1+" and address is "+txtfld2,"MessageBox",1);
}
}
});
btnSubmit.setBounds(179, 198, 75, 23);
contentPane.add(btnSubmit);
}
}
</pre>
<br />
<br />
<br />
OUTPUT:-
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggecvE7WSdQwhkIEvu1XwywTZlVgIpOy1DZYh4_OnXKznRYCsqA3C1f8ugrnNqrCZoUtXBndJYg37tHxsm7noDXbede8-0fNmftQy4bakPiJeSb-dFSUI3b4vpcSV1Uwq-Gazl1lXZHHRY/s1600/show_dialog.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggecvE7WSdQwhkIEvu1XwywTZlVgIpOy1DZYh4_OnXKznRYCsqA3C1f8ugrnNqrCZoUtXBndJYg37tHxsm7noDXbede8-0fNmftQy4bakPiJeSb-dFSUI3b4vpcSV1Uwq-Gazl1lXZHHRY/s1600/show_dialog.png" height="426" width="640" /></a></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/15543355171616208036noreply@blogger.com0