Java - Codetown2024-03-28T13:05:42Zhttps://codetown.com/forum/categories/2197786:Category:587/listForCategory?feed=yes&xn_auth=noError trying to use Fragmenttag:codetown.com,2017-10-10:2197786:Topic:579872017-10-10T13:38:16.614ZRobert Sobolhttps://codetown.com/profile/RobertSobol
<p>I am new to Android. I have been working thru some examples in a book called Head First Android Development. I entered a small program using fragments and get a Casting Error.</p>
<p></p>
<p>cannot cast andoid.app.fragment to com.hilights.rsobol.workout.WorkoutDetailFragment</p>
<p></p>
<p>I am hoping someone can download the attached zip file and show me the error of my ways. It is most likely a simple error that someone with some experience can see.</p>
<p></p>
<p>Thank you in advance…</p>
<p>I am new to Android. I have been working thru some examples in a book called Head First Android Development. I entered a small program using fragments and get a Casting Error.</p>
<p></p>
<p>cannot cast andoid.app.fragment to com.hilights.rsobol.workout.WorkoutDetailFragment</p>
<p></p>
<p>I am hoping someone can download the attached zip file and show me the error of my ways. It is most likely a simple error that someone with some experience can see.</p>
<p></p>
<p>Thank you in advance for your help,</p>
<p>Rob</p>
<p>rsobol@hilightsinc.com</p> Fragment Syntax Problemtag:codetown.com,2017-10-10:2197786:Topic:577882017-10-10T13:32:52.923ZRobert Sobolhttps://codetown.com/profile/RobertSobol
<p>My name is Rob Sobol.</p>
<p></p>
<p>I have been working through a book called Head First Android Development.</p>
<p>I hit a syntax error in a simple exercise that uses one fragment. I have been trying to figure out the error for days. I am hoping some in the forum can download the attached project and show we where I went wrong.</p>
<p>'Inconvertible types; cannot cast 'android.app.Fragment' to 'com.hilights.rsobol.workout.WorkoutDetailFragement'</p>
<p>It most likely is an obvious error…</p>
<p>My name is Rob Sobol.</p>
<p></p>
<p>I have been working through a book called Head First Android Development.</p>
<p>I hit a syntax error in a simple exercise that uses one fragment. I have been trying to figure out the error for days. I am hoping some in the forum can download the attached project and show we where I went wrong.</p>
<p>'Inconvertible types; cannot cast 'android.app.Fragment' to 'com.hilights.rsobol.workout.WorkoutDetailFragement'</p>
<p>It most likely is an obvious error that a newbie like me cannot see.</p>
<p></p>
<p>Thank you in advance for your support,</p>
<p>Rob</p>
<p>rsobol@hilightsinc.com</p> Storing Sensitive Data ( like SSNs )tag:codetown.com,2014-04-24:2197786:Topic:498272014-04-24T20:54:42.350ZKevin Neelandshttps://codetown.com/profile/KevinNeelands
<p>We might have to store Social Security Numbers. We REALLY don't want to do this in our own database, we'd like some external 'vault' service that stores them encrypted and getting to them is difficult. Does anyone have any ideas along these lines?</p>
<p>We might have to store Social Security Numbers. We REALLY don't want to do this in our own database, we'd like some external 'vault' service that stores them encrypted and getting to them is difficult. Does anyone have any ideas along these lines?</p> Oracle Embedded MOOC w/ Raspberry PItag:codetown.com,2014-04-10:2197786:Topic:498122014-04-10T16:35:13.917ZChris Schaeferhttps://codetown.com/profile/ChrisSchaefer
<p>If your interested in playing with Java on Raspberry PI - another round of the "Oracle Massive Open Online Course: Develop Java Embedded Applications Using a Raspberry Pi" is starting May 19th. You can find more details and <a href="https://blogs.oracle.com/java/entry/oracle_massive_open_online_course?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+orana+(OraNA)" target="_blank">register here</a>. Should be fun!</p>
<p></p>
<p>Register soon and be sure to get the required…</p>
<p>If your interested in playing with Java on Raspberry PI - another round of the "Oracle Massive Open Online Course: Develop Java Embedded Applications Using a Raspberry Pi" is starting May 19th. You can find more details and <a href="https://blogs.oracle.com/java/entry/oracle_massive_open_online_course?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+orana+(OraNA)" target="_blank">register here</a>. Should be fun!</p>
<p></p>
<p>Register soon and be sure to get the required hardware in advance if you don't already have everything. They sell a prepackaged bundle, but looks like stock won't arrive for 15-20 business days (last I saw).</p>
<p></p>
<p></p> Documentation standards or guidelines?tag:codetown.com,2014-03-31:2197786:Topic:500072014-03-31T23:34:00.205ZMiekhttps://codetown.com/profile/Miek
<p>Does anyone care to share their suggestions for documentation?</p>
<p>I'm asking because I recently had to change a program I wrote more than five years ago. I'd always thought that I've done a good job of documentation. But going through it was difficult. It WAS pulling apart an Excel in CSV format created and saved off by humans, so there was a lot of exception handling. But still . . . .</p>
<p> - Miek</p>
<p></p>
<p>Does anyone care to share their suggestions for documentation?</p>
<p>I'm asking because I recently had to change a program I wrote more than five years ago. I'd always thought that I've done a good job of documentation. But going through it was difficult. It WAS pulling apart an Excel in CSV format created and saved off by humans, so there was a lot of exception handling. But still . . . .</p>
<p> - Miek</p>
<p></p> JavaFX and Netbeans IDEtag:codetown.com,2012-12-11:2197786:Topic:427402012-12-11T13:48:05.005ZMike Bivinshttps://codetown.com/profile/MikeBivins
<p></p>
<p>Is there any knowledge on the horizon on integrating JavaFX into Netbeans in the same way Swing is integrated into it? Currently, as I know it, you can generated a JavaFX gui - which generates a type of xml which you then need to import it into your Java application you could be developing in Netbeans. I was waiting/hoping for the day when FX get integrated into the Netbeans environment where I could simply drop an FX component into a JPanel.</p>
<p></p>
<p></p>
<p></p>
<p>Is there any knowledge on the horizon on integrating JavaFX into Netbeans in the same way Swing is integrated into it? Currently, as I know it, you can generated a JavaFX gui - which generates a type of xml which you then need to import it into your Java application you could be developing in Netbeans. I was waiting/hoping for the day when FX get integrated into the Netbeans environment where I could simply drop an FX component into a JPanel.</p>
<p></p>
<p></p> Gainesville Events - web and android apptag:codetown.com,2012-12-04:2197786:Topic:429862012-12-04T22:43:04.974ZNemanja Nesic - NEM-https://codetown.com/profile/NemanjaNesicNEM
<p>Hey guys checkout my new android app for social events in Gainesville</p>
<p><br/> <a href="http://goo.gl/qF5sT">http://goo.gl/qF5sT</a> - the web app built in grails <br/> <a href="http://goo.gl/bQHK5">http://goo.gl/bQHK5</a> - google play store<br/><br/></p>
<p>Feel free to question, comment and critique!</p>
<p>Hey guys checkout my new android app for social events in Gainesville</p>
<p><br/> <a href="http://goo.gl/qF5sT">http://goo.gl/qF5sT</a> - the web app built in grails <br/> <a href="http://goo.gl/bQHK5">http://goo.gl/bQHK5</a> - google play store<br/><br/></p>
<p>Feel free to question, comment and critique!</p> Another question on refactoring my NetBeans generated GUI codetag:codetown.com,2012-06-20:2197786:Topic:403902012-06-20T15:25:36.879ZPaul Stearnshttps://codetown.com/profile/PaulStearns
<p>Hello all:</p>
<p></p>
<p>It has been a few months since my last question. Had a lot of other projects taking up my time, but I am back to fighting with my Planetarium lighting controller. I have it working, but I am sure it could be more efficient and prettier to look at.</p>
<p></p>
<p>Since my last post, I finally figured out how to create an object and was able to remove the global variables I had previously created. My application now has two files and not just the long single one…</p>
<p>Hello all:</p>
<p></p>
<p>It has been a few months since my last question. Had a lot of other projects taking up my time, but I am back to fighting with my Planetarium lighting controller. I have it working, but I am sure it could be more efficient and prettier to look at.</p>
<p></p>
<p>Since my last post, I finally figured out how to create an object and was able to remove the global variables I had previously created. My application now has two files and not just the long single one primarily generated by NetBeans. This cleaned up my messy code a little, but I know that there is still more I can do. I have been trying to pull some of the functions I created out of the single file, but I am still not getting something right and I get errors. The IDE tells me that it cannot find the function if it is located in a separate file.</p>
<p></p>
<p>I want to have the establishConnection() and sendCommand() functions separated because I can actually use them in other programs that access the lighting control without going through the GUI.</p>
<p></p>
<p>I wanted to have the updateControlPanelLampOn() function separated because it would be easier for me to make changes if I did not have to constantly scroll down to where it starts in the long block of code. When I take this block out, the IDE tells me it cannot find the various controls.</p>
<p></p>
<p>Just not sure what I am doing wrong.</p>
<p></p>
<p>I pasted a portion of the code here and attached it to the post. There is also a screen capture of what the GUI looks like when it is running. If anyone can help, I would appreciate it.</p>
<p></p>
<p>Paul</p>
<p></p>
<p></p>
<p></p>
<p>import ECCS.eccsLampDevice;<br/>import java.io.*;<br/>import java.net.*;<br/>import javax.swing.UIManager.*;<br/><br/>public class BasicRGBWCoveGUIWithOOP extends javax.swing.JFrame {<br/> eccsLampDevice redCove = new eccsLampDevice();<br/> eccsLampDevice grnCove = new eccsLampDevice();<br/> eccsLampDevice bluCove = new eccsLampDevice();<br/> eccsLampDevice rgb0Cove = new eccsLampDevice();<br/><br/> // IO streams.<br/> private DataOutputStream toServer;<br/> private DataInputStream fromServer; <br/> <br/> /** Creates new form AdvancedRGBCoveGUI */<br/> public BasicRGBWCoveGUIWithOOP() {<br/> initComponents();<br/> establishConnection();<br/> }<br/><br/> @SuppressWarnings("unchecked")<br/> // <editor-fold defaultstate="collapsed" desc="Generated Code"> <br/> private void initComponents() {<br/> // Lots of code generated by NetBeans.<br/> }// </editor-fold> <br/><br/> <br/> /**<br/> * @param args the command line arguments<br/> */<br/> public static void main(String args[]) {<br/><br/> // More code here.<br/> <br/> }<br/> <br/><br/> public final void establishConnection() {<br/> try {<br/> // Create a socket to connect to the server.<br/> Socket socket = new Socket("192.168.10.250", 4760);<br/><br/> // Create an input stream to receive data from the server.<br/> fromServer = new DataInputStream(socket.getInputStream());<br/><br/> // Create an output stream to send data to the server.<br/> toServer = new DataOutputStream(socket.getOutputStream());<br/> }<br/> catch (IOException ex) {<br/> System.err.println(ex);<br/> }<br/> }<br/> <br/> public void sendCommand(String eccsCommand) {<br/> try {<br/> toServer.writeBytes(eccsCommand + "\r");<br/> <br/> toServer.flush();<br/> }<br/> catch (IOException ex) {<br/> System.err.println(ex);<br/> }<br/> }<br/><br/> public void updateControlPanelLampOn(String deviceCommand, String deviceName) {<br/> if ("A".equals(deviceName)) {<br/> jSliderREDCOVE.setValue(redCove.lampLevel);<br/> jTextFieldREDCOVE.setText(String.valueOf(redCove.lampLevel));<br/> jSliderRGBCOVE.setValue(rgb0Cove.lampLevel);<br/> jTextFieldRGBCOVE.setText(String.valueOf(rgb0Cove.lampLevel));<br/> }<br/> else if ("B".equals(deviceName)) {<br/> jSliderGRNCOVE.setValue(grnCove.lampLevel);<br/> jTextFieldGRNCOVE.setText(String.valueOf(grnCove.lampLevel));<br/> jSliderRGBCOVE.setValue(rgb0Cove.lampLevel);<br/> jTextFieldRGBCOVE.setText(String.valueOf(rgb0Cove.lampLevel));<br/> }<br/> else if ("C".equals(deviceName)) {<br/> jSliderBLUCOVE.setValue(bluCove.lampLevel);<br/> jTextFieldBLUCOVE.setText(String.valueOf(bluCove.lampLevel));<br/> jSliderRGBCOVE.setValue(rgb0Cove.lampLevel);<br/> jTextFieldRGBCOVE.setText(String.valueOf(rgb0Cove.lampLevel));<br/> }<br/> else if ("ABC".equals(deviceName)) {<br/> jSliderREDCOVE.setValue(redCove.lampLevel);<br/> jTextFieldREDCOVE.setText(String.valueOf(redCove.lampLevel));<br/> jSliderGRNCOVE.setValue(grnCove.lampLevel);<br/> jTextFieldGRNCOVE.setText(String.valueOf(grnCove.lampLevel));<br/> jSliderBLUCOVE.setValue(bluCove.lampLevel);<br/> jTextFieldBLUCOVE.setText(String.valueOf(bluCove.lampLevel));<br/> jSliderRGBCOVE.setValue(rgb0Cove.lampLevel);<br/> jTextFieldRGBCOVE.setText(String.valueOf(rgb0Cove.lampLevel));<br/> }<br/> sendCommand(deviceCommand + ":100:" + deviceName);<br/> }<br/>}</p> A new scheduler in towntag:codetown.com,2012-05-30:2197786:Topic:397142012-05-30T00:21:41.140ZZemian Denghttps://codetown.com/profile/ZemianDeng
Hello OJUG folks,<br />
<br />
I am excited to tell you that there is a new scheduler project that I've working on, and it's ready for public use. Check out an intro here <a href="http://saltnlight5.blogspot.com/2012/05/hello-developers-i-am-happy-to-annouce.html">http://saltnlight5.blogspot.com/2012/05/hello-developers-i-am-happy-to-annouce.html</a><br />
<br />
Try the download and let me know what you think.…
Hello OJUG folks,<br />
<br />
I am excited to tell you that there is a new scheduler project that I've working on, and it's ready for public use. Check out an intro here <a href="http://saltnlight5.blogspot.com/2012/05/hello-developers-i-am-happy-to-annouce.html">http://saltnlight5.blogspot.com/2012/05/hello-developers-i-am-happy-to-annouce.html</a><br />
<br />
Try the download and let me know what you think.<br />
<a href="https://bitbucket.org/timemachine/scheduler/downloads">https://bitbucket.org/timemachine/scheduler/downloads</a><br />
<br />
Thanks,<br />
Zemian Creating separate class files in a large projecttag:codetown.com,2012-02-02:2197786:Topic:381182012-02-02T22:45:01.627ZPaul Stearnshttps://codetown.com/profile/PaulStearns
<p>Hello all:</p>
<p></p>
<p>I have been working on a GUI interface for controlling lights in a planetarium. I had some trouble getting the communication to happen, and received some help from this forum to get past that hurdle. I now have a functioning GUI that I created with the NetBeans IDE 7.0.1. It is not very pretty, but it works. Hopefully pretty will come once I get all the functions working.</p>
<p></p>
<p>My question this time around is when should I create a new class to do…</p>
<p>Hello all:</p>
<p></p>
<p>I have been working on a GUI interface for controlling lights in a planetarium. I had some trouble getting the communication to happen, and received some help from this forum to get past that hurdle. I now have a functioning GUI that I created with the NetBeans IDE 7.0.1. It is not very pretty, but it works. Hopefully pretty will come once I get all the functions working.</p>
<p></p>
<p>My question this time around is when should I create a new class to do something in the interface? I used the NetBeans IDE to place frames, buttons, and sliders on the GUI and then added the code to get the various functions I wanted. However, the code for the entire project is in a single class file that is over 2000 lines. I still have more to add to the program, and it is already getting difficult to move around in the code.</p>
<p></p>
<p>Is there a set of rules to follow about when to create a new class file? Is it possible to move existing code into a separate class file? Anyone have any thoughts on the subject?</p>
<p></p>
<p>Thanks.</p>
<p></p>
<p>Paul</p>