Search Results

Search found 1555 results on 63 pages for 'scott f'.

Page 32/63 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • jQuery carousel clicks update <select> list's "selected" option to match clicked item's title attrib

    - by Scott B
    The code below allows me to change a preview image outside the carousel widget so that it matches the element under the mouse. For example, if the user mouses over image2's thumbnail, the script updates .selectedImage so that it displays image2's full size version. I'd like to enhance it so that the #myThumbs options listing updates its "selected" option to match the carousel image that receives a click. Mouseover changes the preview image and click changes the select list to match the same name. The items in the carousel will have the same title attribute as the items in the select list, so I would expect that I can pass that value from the carousel to the select list. $(function() { $("#carousel").jCarouselLite({ btnNext: ".next", btnPrev: ".prev", visible: 6, mouseWheel: true, speed: 700 }); $('#carousel').show(); $('#carousel ul li').hover(function(e) { var img_src = $(this).children('img').attr('src'); $('.selectedImage img').attr('src',img_src); } ,function() { $('.selectedImage img').attr('src', '<?php echo $selectedThumb; ?>');}); }); <select id="myThumbs"> <option>image1</option> <option selected="selected">image2</option> <option>image3</option> </select>

    Read the article

  • Stupid newbie c++ two-dimensional array problem.

    - by paulson scott
    I've no idea if this is too newbie or generic for stackoverlflow. Apologies if that's the case, I don't intend to waste time. I've just started working through C++ Primer Plus and I've hit a little stump. This is probably super laughable but: for (int year = 0; year < YEARS; year++) { cout << "Year " << year + 1 << ":"; for (int month = 0; month < MONTHS; month++) { absoluteTotal = (yearlyTotal[year][year] += sales[year][month]); } cout << yearlyTotal[year][year] << endl; } cout << "The total number of books sold over a period of " << YEARS << " years is: " << absoluteTotal << endl; I wish to display the total of all 3 years. The rest of the code works fine: input is fine, individual yearly output is fine but I just can't get 3 years added together for one final total. I did have the total working at one point but I didn't have the individual totals working. I messed with it and reversed the situation. I've been messing with it for God knows how long. Any idea guys? Sorry if this isn't the place!

    Read the article

  • Invalid authorization specification error with Classic ASP accessing SQL Server

    - by Scott
    Hi, I am getting the following error: Invalid authorization specification I've narrowed down the error to my connection string. I have verified the server name, database, user & password are correct. Here is the string: "Provider=SQLOLEDB;Server=xxxxx.db.12345.hostedresource.com;Database=foo;UID=fooUser;PWD=fooPW" The SQL server is hosted on Godaddy so I don't have access to its settings. Please help, I've scoured the internet for a solution!

    Read the article

  • Unable to get data from a WCF client

    - by Scott
    I am developing a DLL that will provide sychronized time stamps to multiple applications running on the same machine. The timestamps are altered in a thread that uses a high performance timer and a scalar to provide the appearance of moving faster than real-time. For obvious reasons I want only 1 instance of this time library, and I thought I could use WCF for the other processes to connect to this and poll for timestamps whenever they want. When I connect however I never get a valid time stamp, just an empty DateTime. I should point out that the library does work. The original implementation was a single DLL that each application incorporated and each one was synced using windows messages. I'm fairly sure it has something to do with how I'm setting up the WCF stuff, to which I am still pretty new. Here are the contract definitions: public interface ITimerCallbacks { [OperationContract(IsOneWay = true)] void TimerElapsed(String id); } [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(ITimerCallbacks))] public interface ISimTime { [OperationContract] DateTime GetTime(); } Here is my class definition: [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] public class SimTimeServer: ISimTime The host setup: // set up WCF interprocess comms host = new ServiceHost(typeof(SimTimeServer), new Uri[] { new Uri("net.pipe://localhost") }); host.AddServiceEndpoint(typeof(ISimTime), new NetNamedPipeBinding(), "SimTime"); host.Open(); and the implementation of the interface function server-side: public DateTime GetTime() { if (ThreadMutex.WaitOne(20)) { RetTime = CurrentTime; ThreadMutex.ReleaseMutex(); } return RetTime; } Lastly the client-side implementation: Callbacks myCallbacks = new Callbacks(); DuplexChannelFactory pipeFactory = new DuplexChannelFactory(myCallbacks, new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/SimTime")); ISimTime pipeProxy = pipeFactory.CreateChannel(); while (true) { string str = Console.ReadLine(); if (str.ToLower().Contains("get")) Console.WriteLine(pipeProxy.GetTime().ToString()); else if (str.ToLower().Contains("exit")) break; }

    Read the article

  • Twitter @anywhere API problems in firefox only

    - by Brian Scott
    I've implemented a simple example of the Twitter @anywhere api to display user hovercards. The example works great in Internet Explorer and Chrome. However, whenever I the page loads in Firefox I receive the following message in an alert window: To set up @anywhere, please provide a client ID Surely if the results are correct in Chrome and IE then everything must be setup correctly? Here is a simple code block which I've tested recreates the problem in Firefox only: <script src="http://platform.twitter.com/anywhere.js?id=WMg5kRMlIw807lRTsktnNQ&amp;v=1" type="text/javascript" > </script> <script type="text/javascript"> twttr.anywhere(onAnywhereLoad); function onAnywhereLoad(twitter) { twitter().hovercards(); }); </script>

    Read the article

  • Perl ftp question, like the previous ones ...

    - by Jerry Scott
    I need to move or copy a simple text file from one web site to another web site. I have administrator rights to both web sites. The first web site has a large data file (again, just a text file), certain records are selected and written to a team file (for entry into a tournament). Next I go through paypal and pay for the entries. The second site is for the the club running the tournament and I use IPN to return to a script on their site and if it verified, I add the team memebers into the master file for the tournament. I am limited to the ONE IPN script on the tournament site because I have a ton of other entries that come in from all over. The first site has the rosters for the state and no need to type all that data from each club, use the rosters like I use for all the non-paypal tounamenmts. I can ftp the team file to the second server and place it in the folder just like it was created from scratch from that server originally and everything should go fine but I took the examples and tried them and nothing. Here's the code section: my $custom = $in->param('custom'); my $filename = "$ENV{DOCUMENT_ROOT}/database/$custom"; my $usjochost = '208.109.14.105'; my $okserieshost = '208.109.181.196'; my $usjocuser = 'teamentry'; my $okseriesuser = 'okwaentry'; my $usjocpw = 'Password1'; my $okseriespw = 'Password1'; my $file = $custom; my $usjocpath ='/home/content/u/s/j/usjoc/html/database/'; my $okseriespath ='/home/content/o/k/s/okseries/html/database/'; $ftp = Net::FTP->new($okserieshost, Debug => 0) or die "Could not connect to '$okserieshost': $@"; $ftp->login($okseriesuser, $okseriespw) or die sprintf "Could not login: %s", $ftp->message; #$ftp->cwd(/database) or die sprintf "Could not login: %s", $ftp->message; $ftp->get($filename); #$ftp = Net::FTP->new($usjochost, Debug => 0) or die "Could not connect to '$usjochost': $@"; $ftp->quit; I NEED to READ the file on the first web site (okseries.com) and write the file on the second web site (usjoc.com). I have no problem reading and writing the file on the server, is sending the file to the second server. HELP! I'm not a genius at PERL.

    Read the article

  • Difference in select for update of ... in Oracle Database 10g and 11g

    - by sax
    Hi, I found out that Oracle Database 10g and 11g treat the following PL/SQL block differently (I am using scott schema for convenience): DECLARE v_ename bonus.ename%TYPE; BEGIN SELECT b.ename INTO v_ename FROM bonus b JOIN emp e ON b.ename = e.ename JOIN dept d ON d.deptno = e.deptno WHERE b.ename = 'Scott' FOR UPDATE OF b.ename; END; / While in 10g (10.2) this code ends successfully (well NO_DATA_FOUND exception is raised but that is expected), in 11g (11.2) it raises exception "column ambiguously defined". And that is definitely not expected. It seems like it does not take into account table alias because I found out that when I change the column in FOR UPDATE OF e.empno (also does not work) to e.mgr (which is unique) it starts working. So is this some error in 11g? Any thoughts?

    Read the article

  • Visual Studio 2008 profiler analysis - missing time

    - by Scott Vercuski
    I ran the Visual Studio 2008 profiler against my ASP.NET application and came up with the following result set. CURRENT FUNCTION TIME (msec) ---------------------------------------------------|-------------- Data.GetItem(params) | 10,158.12 ---------------------------------------------------|-------------- Functions that were called by Data.GetItem(params) TIME (msec) ---------------------------------------------------|-------------- Model.GetSubItem(params) | 0.83 Model.GetSubItem2(params) | 0.77 Model.GetSubItem3(params) | 0.76 etc. The issue I'm facing is that the sum of the Functions called by Data.GetItem(params) do not sum up to the 10,158.12 msec total. This would lead me to believe that the bulk of the time is actually spent executing the code within that method. My question is ... does Visual Studio provide a way to analyze the method itself so I can see which sections of code are taking the longest? if it does not are there any recommended tools to do this? or should I start writing my own timing scripts? Thank you

    Read the article

  • How to do drag-n-drop and resize on an image using jQuery?

    - by Scott
    How do I resize and image using jQuery but keep its aspect ratio the same? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>CrossSlide - A jQuery plugin to create pan and cross-fade animations</title> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> </head> <body> <style type="text/css"> #resizebleImage { background: silver; } </style> <script type="text/javascript"> $(document).ready(function(){ $("#resizebleImage").resizable().parent().draggable(); }); </script> <img id="resizebleImage" src="http://images.askmen.com/galleries/singer/gloria-estefan/pictures/gloria-estefan-picture-4.jpg"> </body> </html>

    Read the article

  • WPF - Two way binding use a user control...binding to object, not an element!

    - by Scott
    I created an object with a simple property with a default value. I then created a user control that has a text box in it. I set the datacontext of the user control to the object. The text box correctly shows the properties default value but I can't seem to update the property value when the user changes the text box value. I created a simple project to illustrate my code. Thanks for the help!! public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } private string _titleValue; public string TitleValue { get { return _titleValue; } set { _titleValue = value; textBox1.Text = _titleValue; } } public static readonly DependencyProperty TitleValueProperty = DependencyProperty.Register( "TitleValue", typeof(string), typeof(UserControl1), new FrameworkPropertyMetadata(new PropertyChangedCallback(titleUpdated)) ); //Don't think I should need to do this!!! private static void titleUpdated(DependencyObject d, DependencyPropertyChangedEventArgs e) { ((UserControl1)d).TitleValue = (string)e.NewValue; } } <UserControl x:Class="WpfApplication1.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <Grid> <TextBox Height="23" HorizontalAlignment="Left" Margin="94,97,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" Text="{Binding Path=TitleValue, Mode=TwoWay}"/> </Grid> </UserControl> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); var dummy = new DummyObject("This is my title."); userControl11.DataContext = dummy; } private void button1_Click(object sender, RoutedEventArgs e) { MessageBox.Show("The value is: " + ((DummyObject)userControl11.DataContext).Title); } } <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:my="clr-namespace:WpfApplication1"> <Grid> <my:UserControl1 HorizontalAlignment="Left" Margin="95,44,0,0" x:Name="userControl11" VerticalAlignment="Top" Height="191" Width="293" TitleValue="{Binding Path=Title, Mode=TwoWay}"/> <Button Content="Check Value" Height="23" HorizontalAlignment="Left" Margin="20,12,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" /> </Grid> </Window>

    Read the article

  • how to add xml namespces

    - by Scott Kramer
    Hi: This feed (snippit of it) needs to look exactly like this: <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd"> what do I add to this C# code to add that extra xmlns, xsi junk: writer.WriteStartDocument(); writer.WriteStartElement("AmazonEnvelope"); this feed is rejected without it-- Thanks!!

    Read the article

  • Display the same prev/next usercontrol twice on a page

    - by Scott
    I haven't seen a question like this. I have a prev/next paging control on my page, one at the top and one at the bottom like this: top pager product catalog bottom pager Each pager is bound to a PagedDataSource that is exactly the same. I don't want to duplicate effort, so I am trying to figure out a way to do the processing once, but show the control twice.

    Read the article

  • Concatenating a string and byte array in to unmanaged memory.

    - by Scott Chamberlain
    This is a followup to my last question. I now have a byte[] of values for my bitmap image. Eventually I will be passing a string to the print spooler of the format String.Format("GW{0},{1},{2},{3},", X, Y, stride, _Bitmap.Height) + my binary data; I am using the SendBytesToPrinter command from here. Here is my code so far to send it to the printer public static bool SendStringPlusByteBlockToPrinter(string szPrinterName, string szString, byte[] bytes) { IntPtr pBytes; Int32 dwCount; // How many characters are in the string? dwCount = szString.Length; // Assume that the printer is expecting ANSI text, and then convert // the string to ANSI text. pBytes = Marshal.StringToCoTaskMemAnsi(szString); pBytes = Marshal.ReAllocCoTaskMem(pBytes, szString.Length + bytes.Length); Marshal.Copy(bytes,0, SOMTHING GOES HERE,bytes.Length); // this is the problem line // Send the converted ANSI string + the concatenated bytes to the printer. SendBytesToPrinter(szPrinterName, pBytes, dwCount); Marshal.FreeCoTaskMem(pBytes); return true; } My issue is I do not know how to make my data appended on to the end of the string. Any help would be greatly appreciated, and if I am doing this totally wrong I am fine in going a entirely different way (for example somehow getting the binary data concatenated on to the string before the move to unmanaged space. P.S. As a second question, will ReAllocCoTaskMem move the data that is sitting in it before the call to the new location?

    Read the article

  • Grouping XSLT nodes via transformation

    - by scott
    I'm trying to create a page like this via XSLT transformation. Pages page1 page2 Links link1 link2 Here is the xml <siteMenu> <Pages> <title>page1</title> </Pages> <Pages> <title>page2</title> </Pages> <Links> <title>link1</title> </Links> <Links> <title>link2</title> </Links> </siteMenu> I tried using <xsl:for-each select="*"> and <xsl:for-each-group select="*" group-by="@v"> but that gives me every element, but how can i separate them out based on the parent node?

    Read the article

  • Paging & Sorting grids with ASP.Net MVC

    - by Scott Ivey
    I'm new to MVC, and am not following how you'd do paging and sorting on a grid. I'm used to using the asp.Net GridView control with an ObjectDataSource pointed at objects in our business layer - and in that case the ODS handles all of the paging & sorting using the methods that our ORM generates on the objects. I've looked at using the same ORM with MVC - and things work out fine there - i just loop thru the collections to build the table on the page - but without the ODS to handle the paging & sorting, i'm confused as to how I'd handle that. Would I have a separate controller for the paging and sorting? I'm not sure what the best practices are for this scenario, so if someone can point me in the right direction it would be much appreciated. Edit: Ok, so I understand that I need to roll my own - but where do I start? I've created a CustomerController, and a view that displays a table of customers that looks like below - and I want to sort on FirstName or LastName columns. My Model has a Sort() method on it that'll take a string sort expression in the format that would be used by a GridView/ODS pair. Would I create a new Action on my CustomerController called Sort, and put an ActionLink in my header? <table> <tr> <th> First Name </th> <th> Last Name </th> </tr> <% foreach (var item in Model) { %> <tr> <td> <%= Html.Encode(item.FirstName) %> </td> <td> <%= Html.Encode(item.LastName) %> </td> </tr> <% } %> </table>

    Read the article

  • Sql Compact and __sysobjects

    - by Scott Wisniewski
    I have some SQL Compact queries that create tables inside of transaction. This is mainly because I need to simulate temporary tables, which SQL Compact does not support. I do this by creating a real table, and then dropping it at the end of the transaction. This mostly works. Sometimes, however, when creating the tables Sql Compact will try to acquire PAGE level locks on the __sysobjects table. If there are several concurrent queries running that create "temp" tables, the attempt to acquire a page lock can result in a dead lock followed by a SqlLockTimeout exception. For normal tables I could fix this using a "with (rowlock)" hint. However, because I'm not writing the query to insert into __sysobjets (SQL server does that in response to "create table") I can't do this. Does anyone know of a way I could get around this? I've thought about pulling the table creation out of the transaction, but that opens up the possibility of phantom temporary tables that I'd then need to clean up regularly. Ideally I'd like to avoid that if possible.

    Read the article

  • Does it ever make sense to make a fundamental (non-pointer) parameter const?

    - by Scott Smith
    I recently had an exchange with another C++ developer about the following use of const: void Foo(const int bar); He felt that using const in this way was good practice. I argued that it does nothing for the caller of the function (since a copy of the argument was going to be passed, there is no additional guarantee of safety with regard to overwrite). In addition, doing this prevents the implementer of Foo from modifying their private copy of the argument. So, it both mandates and advertises an implementation detail. Not the end of the world, but certainly not something to be recommended as good practice. I'm curious as to what others think on this issue. Edit: OK, I didn't realize that const-ness of the arguments didn't factor into the signature of the function. So, it is possible to mark the arguments as const in the implementation (.cpp), and not in the header (.h) - and the compiler is fine with that. That being the case, I guess the policy should be the same for making local variables const. One could make the argument that having different looking signatures in the header and source file would confuse others (as it would have confused me). While I try to follow the Principle of Least Astonishment with whatever I write, I guess it's reasonable to expect developers to recognize this as legal and useful.

    Read the article

  • Open Source Salon Management Software Suggestions?

    - by Brian Scott
    I'm looking for a decent open source salon management system to recommend to a friend. I've considered writing a new system in .Net but the website aspect is already covered. What's really required at this stage is an decent reservation and stock management application that I could put in place for them. If there are recommendations for commericial pacakages which are reasonably priced I would also like to hear them. Thanks.

    Read the article

  • What are the pros/cons to these 2 ways of defining parameters for a web service method

    - by Antony Scott
    I have an existing web service I need to expand, but it has not gone into production yet. So, I am free to change the contracts as I see fit. But I am not sure of the best way to define the methods. I am leaning towards Method 2 for no other reason than I cannot think of good names to give the parameters classes! Are there any major disadvantages to using Method 2 over Method 1? Method 1 [DataContract(Namespace = Constants.ServiceNamespace)] public class MyParameters { [DataMember(Order = 1, IsRequired = true)] public int CompanyID { get; set; } [DataMember(Order = 2, IsRequired = true)] public string Filter { get; set; } } [ServiceContract(Namespace = Constants.ServiceNamespace)] public interface IMyService { [OperationContract, FaultContract(MyServiceFault)] MyResult MyMethod(MyParameters params); } Method 2 public interface IMyService { [OperationContract, FaultContract(MyServiceFault)] MyResult MyMethod(int companyID, string filter); }

    Read the article

  • A "Trig" Calculating Class

    - by Clinton Scott
    I have been trying to create a gui that calculates trigonometric functions based off of the user's input. I have had success in the GUI part, but my class that I wrote to hold information using inheritance seems to be messed up, because when I run it gives an error saying: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - constructor ArcTrigCalcCon in class TrigCalc.ArcTrigCalcCon cannot be applied to given types; required: double,double,double,double,double,double found: java.lang.Double,java.lang.Double,java.lang.Double reason: actual and formal argument lists differ in length at TrigCalc.TrigCalcGUI.(TrigCalcGUI.java:31) at TrigCalc.TrigCalcGUI.main(TrigCalcGUI.java:87) Java Result: 1 and says it is the object causing the problem. Below Will be my code. First I will put up my inheritance class with cosecant secant and cotangent and then my original class with the original 3 trig functions: { public ArcTrigCalcCon(double s, double cs, double t, double csc, double sc, double ct) { // Inherit from the Trig Calc class super(s, cs, t); cosecant = 1/s; secant = 1/cs; cotangent = 1/t; } public void setCsc(double csc) { cosecant = csc; } public void setSec(double sc) { secant = sc; } public void setCot(double ct) { cotangent = ct; } } Here is the first Trigonometric class: public class TrigCalcCon { public double sine; public double cosine; public double tangent; public TrigCalcCon(double s, double cs, double t) { sine = s; cosine = cs; tangent = t; } public void setSin(double s) { sine = s; } public void setCos(double cs) { cosine = cs; } public void setTan(double t) { tangent = t; } public void set(double s, double cs, double t) { sine = s; cosine = cs; tangent = t; } public double getSin() { return Math.sin(sine); } public double getCos() { return Math.cos(cosine); } public double getTan() { return Math.tan(tangent); } } and here is the demo class to run the gui: public class TrigCalcGUI extends JFrame implements ActionListener { // Instance Variables private String input; private Double s, cs, t, csc, sc, ct; private JPanel mainPanel, sinPanel, cosPanel, tanPanel, cscPanel, secPanel, cotPanel, buttonPanel, inputPanel, displayPanel; // Panel Display private JLabel sinLabel, cosLabel, tanLabel, secLabel, cscLabel, cotLabel, inputLabel; private JTextField sinTF, cosTF, tanTF, secTF, cscTF, cotTF, inputTF; //Text Fields for sin, cos, and tan, and inverse private JButton calcButton, clearButton; // Calculate and Exit Buttons // Object ArcTrigCalcCon trC = new ArcTrigCalcCon(s, cs, t); public TrigCalcGUI() { // title bar text. super("Trig Calculator"); // Corner exit button action. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Create main panel to add each panel to mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(3,2)); displayPanel = new JPanel(); displayPanel.setLayout(new GridLayout(3,2)); // Assign Panel to each variable inputPanel = new JPanel(); sinPanel = new JPanel(); cosPanel = new JPanel(); tanPanel = new JPanel(); cscPanel = new JPanel(); secPanel = new JPanel(); cotPanel = new JPanel(); buttonPanel = new JPanel(); // Call each constructor buildInputPanel(); buildSinCosTanPanels(); buildCscSecCotPanels(); buildButtonPanel(); // Add each panel to content pane displayPanel.add(sinPanel); displayPanel.add(cscPanel); displayPanel.add(cosPanel); displayPanel.add(secPanel); displayPanel.add(tanPanel); displayPanel.add(cotPanel); // Add three content panes to GUI mainPanel.add(inputPanel, BorderLayout.NORTH); mainPanel.add(displayPanel, BorderLayout.CENTER); mainPanel.add(buttonPanel, BorderLayout.SOUTH); //add mainPanel this.add(mainPanel); // size of window to content this.pack(); // display window setVisible(true); } public static void main(String[] args) { new TrigCalcGUI(); } private void buildInputPanel() { inputLabel = new JLabel("Enter a Value: "); inputTF = new JTextField(5); inputPanel.add(inputLabel); inputPanel.add(inputTF); } // Building Constructor for sinPanel cosPanel, and tanPanel private void buildSinCosTanPanels() { // Set layout and border for sinPanel sinPanel.setLayout(new GridLayout(2,2)); sinPanel.setBorder(BorderFactory.createTitledBorder("Sine")); // sinTF = new JTextField(5); sinTF.setEditable(false); sinPanel.add(sinTF); // Set layout and border for cosPanel cosPanel.setLayout(new GridLayout(2,2)); cosPanel.setBorder(BorderFactory.createTitledBorder("Cosine")); cosTF = new JTextField(5); cosTF.setEditable(false); cosPanel.add(cosTF); // Set layout and border for tanPanel tanPanel.setLayout(new GridLayout(2,2)); tanPanel.setBorder(BorderFactory.createTitledBorder("Tangent")); tanTF = new JTextField(5); tanTF.setEditable(false); tanPanel.add(tanTF); } // Building Constructor for cscPanel secPanel, and cotPanel private void buildCscSecCotPanels() { // Set layout and border for cscPanel cscPanel.setLayout(new GridLayout(2,2)); cscPanel.setBorder(BorderFactory.createTitledBorder("Cosecant")); // cscTF = new JTextField(5); cscTF.setEditable(false); cscPanel.add(cscTF); // Set layout and border for secPanel secPanel.setLayout(new GridLayout(2,2)); secPanel.setBorder(BorderFactory.createTitledBorder("Secant")); secTF = new JTextField(5); secTF.setEditable(false); secPanel.add(secTF); // Set layout and border for cotPanel cotPanel.setLayout(new GridLayout(2,2)); cotPanel.setBorder(BorderFactory.createTitledBorder("Cotangent")); cotTF = new JTextField(5); cotTF.setEditable(false); cotPanel.add(cotTF); } private void buildButtonPanel() { // Create buttons and add events calcButton = new JButton("Calculate"); calcButton.addActionListener(new CalcButtonListener()); clearButton = new JButton("Clear"); clearButton.addActionListener(new ClearButtonListener()); buttonPanel.add(calcButton); buttonPanel.add(clearButton); } @Override public void actionPerformed(ActionEvent e) { } private class CalcButtonListener implements ActionListener { public void actionPerformed(ActionEvent ae) { // Declare boolean variable boolean incorrect = true; // Set input variable to input text field text input = inputTF.getText(); ImageIcon newIcon; ImageIcon frowny = new ImageIcon(TrigCalcGUI.class.getResource("/Sad_Face.png")); Image gm = frowny.getImage(); Image newFrowny = gm.getScaledInstance(100, 100, java.awt.Image.SCALE_FAST); newIcon = new ImageIcon(newFrowny); // If boolean is true, throw exception if(incorrect) { try{Double.parseDouble(input); incorrect = false;} catch(NumberFormatException nfe) { String s = "Invalid Input " + "/n Input Must Be a Numerical value." + "/nPlease Press Ok and Try Again"; JOptionPane.showMessageDialog(null, s, "Invalid", JOptionPane.ERROR_MESSAGE, newIcon); inputTF.setText(""); inputTF.requestFocus(); } } // If boolean is not true, proceed with output if (incorrect != true) { /* Set each text field's output to the String double value * of inputTF */ sinTF.setText(input); cosTF.setText(input); tanTF.setText(input); cscTF.setText(input); secTF.setText(input); cotTF.setText(input); } } } /** * Private inner class that handles the event when * the user clicks the Exit button. */ private class ClearButtonListener implements ActionListener { public void actionPerformed(ActionEvent ae) { // Clear field sinTF.setText(""); cosTF.setText(""); tanTF.setText(""); cscTF.setText(""); secTF.setText(""); cotTF.setText(""); // Clear textfield and set cursor focus to field inputTF.setText(""); inputTF.requestFocus(); } } }

    Read the article

  • Invert the 1bbp color under a rectangle.

    - by Scott Chamberlain
    I am working with GDI+, the image I am working with is a 1bbp image. What i would like to do is draw a rectangle on the image and everything under that rectangle will be inverted (white pixels will become black and black pixels become white). All of the sample code I have seen is for 8 bit RGB color scale images, and I don't think the techniques they use will work for me. Here is the code I have so far. This is the parent control, one of the Epl2.IDrawableCommand's will be the command that does the inverting. protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (Label != null) { using (Bitmap drawnLabel = new Bitmap((int)((float)Label.LabelHeight * _ImageScaleFactor), (int)((float)Label.LableLength *(int) _ImageScaleFactor), System.Drawing.Imaging.PixelFormat.Format1bppIndexed)) { using (Graphics drawBuffer = Graphics.FromImage(drawnLabel)) { drawBuffer.ScaleTransform(_ImageScaleFactor, _ImageScaleFactor); foreach (Epl2.IDrawableCommand cmd in Label.Collection) { cmd.Paint(drawBuffer); } drawBuffer.ResetTransform(); } drawnLabel.RotateFlip(Rotation); pbLabelDrawArea.Size = drawnLabel.Size; using (Graphics drawArea = pbLabelDrawArea.CreateGraphics()) { drawArea.Clear(Color.White); drawArea.DrawImage(drawnLabel, new Point(0, 0)); } } } } What should I put in the Paint(Graphic g) for this command?

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >